-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathBase.vue
63 lines (61 loc) · 1.55 KB
/
Base.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
<!-- this is an example -->
<template lang="pug">
div
h2 Base
Tree(:data="originalData" draggable crossTree ref="tree1" @change="tree1Change")
div(slot-scope="{data, store}")
b(v-if="data.children && data.children.length" @click="store.toggleOpen(data)") {{data.open ? '-' : '+'}}
span {{data.text}}
</template>
<script>
import Tree from '@/components/DraggableTree'
export default {
components: {Tree},
data() {
return {
originalData: [
{text: 'node 1'},
{text: 'node 2'},
{text: 'node 3'},
{text: 'node 4'},
{text: 'node 4 undroppable', droppable: false},
{text: 'node 5', children: [
{text: 'node 1'},
{text: 'node 2', children: [
{text: 'node 3'},
{text: 'node 4'},
]},
{text: 'node 2 undroppable', droppable: false, children: [
{text: 'node 3'},
{text: 'node 4'},
]},
{text: 'node 2', children: [
{text: 'node 3'},
{text: 'node 4 undroppable', droppable: false},
]},
{text: 'node 3'},
{text: 'node 4'},
{text: 'node 3'},
{text: 'node 4'},
{text: 'node 3'},
{text: 'node 4'},
{text: 'node 3'},
{text: 'node 4'},
]},
],
data: null,
}
},
// computed: {},
// watch: {},
methods: {
tree1Change(node, targetTree) {
this.data = targetTree.getPureData()
},
},
// created() {},
// mounted() {},
}
</script>
<style>
</style>