/
App.vue
73 lines (71 loc) · 1.34 KB
/
App.vue
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<template>
<vue-kityminder
style="height: 600px"
ref="kityminder"
theme="classic"
template="fish-bone"
:value="val"
:toolbar-status="toolbar"
@content-change="handleContent"
@node-change="handleNode"
@node-remove="handleRemove"
@selection-change="handleSelection"
>
</vue-kityminder>
</template>
<script>
export default {
name: 'App',
data() {
return {
val: {
data: {
id: 1,
text: 'test'
},
children: [
{
data: {
id: 2,
text: '新闻\nsrc/module/node.j'
}
},
{
data: {
id: 3,
text: '网页'
}
}
]
},
toolbar: {
appendSiblingNode: true,
arrangeUp: true,
arrangeDown: false,
text: true,
template: true,
hand: false,
resetLayout: true,
zoomIn: true,
}
}
},
methods: {
handleContent(data) {
console.log(data);
},
handleNode(data) {
console.log(data);
if (data.id === 0) {
this.$refs.kityminder.setNodeData('id', 12138);
}
},
handleRemove(data) {
console.log(data);
},
handleSelection(data) {
console.log(data);
}
}
}
</script>