mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 16:22:57 +08:00
perf: 处理注册时的分组场景
This commit is contained in:
parent
1fac9e5254
commit
0aac4efa1b
@ -3,7 +3,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
||||
import { ChartEditStoreEnum, ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
|
||||
import { fetchChartComponent, fetchConfigComponent, createComponent } from '@/packages/index'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { CreateComponentType, CreateComponentGroupType, ConfigType } from '@/packages/index.d'
|
||||
|
||||
// 请求处理
|
||||
export const useSync = () => {
|
||||
@ -25,15 +25,18 @@ export const useSync = () => {
|
||||
chartHistoryStore.clearForwardStack()
|
||||
}
|
||||
// 列表组件注册
|
||||
projectData.componentList.forEach(async (e: CreateComponentType) => {
|
||||
if (!window['$vue'].component(e.chartConfig.chartKey)) {
|
||||
projectData.componentList.forEach(async (e: CreateComponentType | CreateComponentGroupType) => {
|
||||
// 排除分组
|
||||
if (e.isGroup) return
|
||||
const target = e as CreateComponentType
|
||||
if (!window['$vue'].component(target.chartConfig.chartKey)) {
|
||||
window['$vue'].component(
|
||||
e.chartConfig.chartKey,
|
||||
fetchChartComponent(e.chartConfig)
|
||||
target.chartConfig.chartKey,
|
||||
fetchChartComponent(target.chartConfig)
|
||||
)
|
||||
window['$vue'].component(
|
||||
e.chartConfig.conKey,
|
||||
fetchConfigComponent(e.chartConfig)
|
||||
target.chartConfig.conKey,
|
||||
fetchConfigComponent(target.chartConfig)
|
||||
)
|
||||
}
|
||||
})
|
||||
@ -44,7 +47,7 @@ export const useSync = () => {
|
||||
for (const comItem of projectData[key]) {
|
||||
// 补充 class 上的方法
|
||||
let newComponent: CreateComponentType = await createComponent(
|
||||
comItem.chartConfig
|
||||
comItem.chartConfig as ConfigType
|
||||
)
|
||||
chartEditStore.addComponentList(
|
||||
Object.assign(newComponent, {...comItem, id: getUUID()}),
|
||||
|
Loading…
Reference in New Issue
Block a user