perf: 优化交互结构,优化时间选择器组件

This commit is contained in:
奔跑的面条
2023-03-14 22:19:55 +08:00
parent 63db4f8c87
commit 40453c51bb
9 changed files with 125 additions and 118 deletions
+2 -4
View File
@@ -87,16 +87,14 @@ export const useChartDataFetch = (
}
}
// 立即调用
fetchFn()
// 组件交互处理监听
// 普通初始化与组件交互处理监听
watch(
() => targetComponent.request,
() => {
fetchFn()
},
{
immediate: true,
deep: true
}
)
+8 -4
View File
@@ -9,14 +9,13 @@ type ChartEditStoreType = typeof useChartEditStore
export const useChartInteract = (
chartConfig: CreateComponentType,
useChartEditStore: ChartEditStoreType,
param: { [name: string]: string },
onEvent: string
param: { [T: string]: any },
interactEventOn: string
) => {
const chartEditStore = useChartEditStore()
const { interactEvents } = chartConfig.events
const fnOnEvent = interactEvents.filter(item => {
return item.interactOn === onEvent
return item.interactOn === interactEventOn
})
if (fnOnEvent.length === 0) return
@@ -34,3 +33,8 @@ export const useChartInteract = (
})
})
}
// 联动事件触发的 type 变更时,清除当前绑定内容
export const clearInteractEvent = (chartConfig: CreateComponentType) => {
}