index.vue
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<template>
<div>
<n-tree
:accordion="treeConfig.accordion"
:checkable="treeConfig.checkable"
:default-expand-all="treeConfig.defaultExpandAll"
block-line
block-node
:data="dataset"
key-field="id"
label-field="name"
children-field="children"
@update:selected-keys="onClick"
/>
</div>
</template>
<script setup lang="ts">
import { PropType, toRefs } from 'vue'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { useChartInteract } from '@/hooks/external/useChartSelectInteract.hook'
import { InteractEventOn } from '@/enums/eventEnum'
import { ComponentInteractParamsEnum } from './interact'
const props = defineProps({
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true
}
})
const { dataset, treeConfig } = toRefs(props.chartConfig.option)
const onClick = (v: string[]) => {
useChartInteract(
props.chartConfig,
useChartEditStore,
{ [ComponentInteractParamsEnum.DATA]: v[0] },
InteractEventOn.CHANGE
)
}
</script>
<style lang="scss" scoped></style>