diff --git a/src/plugins/customComponents.ts b/src/plugins/customComponents.ts index b7b4aef2..986b226b 100644 --- a/src/plugins/customComponents.ts +++ b/src/plugins/customComponents.ts @@ -10,8 +10,9 @@ import { CreateComponentType } from '@/packages/index.d' * @param app */ export const setupPreviewPackages = (app: App) => { + if(!document.location.hash.includes('preview')) return const localStorageInfo = getLocalStorageInfo() - if(!document.location.hash.includes('preview') || !localStorageInfo) return + if(!localStorageInfo) return localStorageInfo.componentList.forEach(async (e: CreateComponentType) => { if (!app.component(e.key)) { const chart = fetchChartComponent(e.chartConfig) diff --git a/src/views/preview/utils/index.ts b/src/views/preview/utils/index.ts index 3d468bc2..7c1248d0 100644 --- a/src/views/preview/utils/index.ts +++ b/src/views/preview/utils/index.ts @@ -15,6 +15,8 @@ export const getLocalStorageInfo = () => { StorageEnum.GO_CHART_STORAGE_LIST ) + if(!storageList) return + for (let i = 0; i < storageList.length; i++) { if (id.toString() === storageList[i]['id']) { return storageList[i]