Showing
1 changed file
with
16 additions
and
5 deletions
| ... | ... | @@ -44,6 +44,8 @@ import { useUserStore } from '@/store/external/modules/user' |
| 44 | 44 | import { checkSharePageNeedAccessToken, getPublicToken, getShareContentData } from '@/api/external/sys/share' |
| 45 | 45 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
| 46 | 46 | import { fetchChartComponent } from '@/packages' |
| 47 | +import { CreateComponentType } from '@/packages/index.d' | |
| 48 | +import { CreateComponentGroupType } from '@/packages/index.d' | |
| 47 | 49 | |
| 48 | 50 | const allowLoadPreviewPage = ref(true) |
| 49 | 51 | const showModal = ref(false) |
| ... | ... | @@ -78,6 +80,19 @@ const sharePageHandlerProcess = async () => { |
| 78 | 80 | } |
| 79 | 81 | } |
| 80 | 82 | |
| 83 | +const handleRegisterComponent = (record: (CreateComponentType | CreateComponentGroupType)[]) => { | |
| 84 | + const fn = (params: (CreateComponentType | CreateComponentGroupType)[]) => { | |
| 85 | + for (const item of params) { | |
| 86 | + if (item.isGroup) { | |
| 87 | + fn(item.groupList || []) | |
| 88 | + continue | |
| 89 | + } | |
| 90 | + componentInstall(item.chartConfig.chartKey, fetchChartComponent(item.chartConfig)) | |
| 91 | + } | |
| 92 | + } | |
| 93 | + fn(record) | |
| 94 | +} | |
| 95 | + | |
| 81 | 96 | const isEmpty = ref(false) |
| 82 | 97 | const getSharePageContentData = async () => { |
| 83 | 98 | try { |
| ... | ... | @@ -93,11 +108,7 @@ const getSharePageContentData = async () => { |
| 93 | 108 | chartEditStore.editCanvasConfig = editCanvasConfig |
| 94 | 109 | chartEditStore.requestGlobalConfig = requestGlobalConfig |
| 95 | 110 | chartEditStore.componentList = componentList |
| 96 | - | |
| 97 | - // register 组件 | |
| 98 | - componentList.forEach(item => { | |
| 99 | - componentInstall(item.chartConfig.chartKey, fetchChartComponent(item.chartConfig)) | |
| 100 | - }) | |
| 111 | + handleRegisterComponent(componentList) | |
| 101 | 112 | } |
| 102 | 113 | setTitle(dataViewName || '') |
| 103 | 114 | showModal.value = false | ... | ... |