Commit 18094fa72bb157aeb7421b10c4a9474cbe84690f
1 parent
b0951b28
feat(src/hooks/external): 新增联动组件hooks代码注释
Showing
1 changed file
with
12 additions
and
9 deletions
... | ... | @@ -10,7 +10,7 @@ export const useChartInteract = ( |
10 | 10 | chartConfig: CreateComponentType, |
11 | 11 | useChartEditStore: ChartEditStoreType, |
12 | 12 | param: { [T: string]: any }, |
13 | - interactEventOn: string, | |
13 | + interactEventOn: string | |
14 | 14 | ) => { |
15 | 15 | const chartEditStore = useChartEditStore() |
16 | 16 | const { interactEvents } = chartConfig.events |
... | ... | @@ -30,25 +30,28 @@ export const useChartInteract = ( |
30 | 30 | Header.value[key] = param[item.interactFn[key]] |
31 | 31 | } |
32 | 32 | }) |
33 | - updateIndex(chartConfig) | |
33 | + setJump(chartConfig) | |
34 | 34 | }) |
35 | - | |
36 | - function updateIndex(chart: any) { | |
35 | + function setJump(chart: CreateComponentType) { | |
36 | + /** | |
37 | + * 通过页面显示隐藏来模拟页面跳转 | |
38 | + * 当前点击对象和绑定的联动组件(分组或单个)内容隐藏,目标对象和绑定的联动组件(分组或单个)内容显示 | |
39 | + */ | |
37 | 40 | try { |
38 | 41 | const targetId = chart.option.dataset[0].target |
39 | 42 | const currentId = chart.option.dataset[0].current |
40 | - const currentButtonId = chart.option.dataset[0].currentButton | |
41 | 43 | const targetButtonId = chart.option.dataset[0].targetButton |
44 | + const currentButtonId = chart.option.dataset[0].currentButton | |
42 | 45 | const targetIndex = chartEditStore.fetchTargetIndex(targetId) |
43 | 46 | const currentIndex = chartEditStore.fetchTargetIndex(currentId) |
44 | - const currentButtonIndex = chartEditStore.fetchTargetIndex(currentButtonId) | |
45 | 47 | const targetButtonIndex = chartEditStore.fetchTargetIndex(targetButtonId) |
48 | + const currentButtonIndex = chartEditStore.fetchTargetIndex(currentButtonId) | |
46 | 49 | chartEditStore.componentList[targetIndex].status.hide = false |
47 | 50 | chartEditStore.componentList[currentIndex].status.hide = true |
48 | - chartEditStore.componentList[currentButtonIndex].status.hide = true | |
49 | 51 | chartEditStore.componentList[targetButtonIndex].status.hide = false |
50 | - } catch (e) { | |
51 | - console.error(e) | |
52 | + chartEditStore.componentList[currentButtonIndex].status.hide = true | |
53 | + } finally { | |
54 | + console.log() | |
52 | 55 | } |
53 | 56 | } |
54 | 57 | } | ... | ... |