Commit 75dad873769f03af596386d795db439bd5f75a45
1 parent
01b8d340
add listener on Tree: on-toggle-expand
Showing
2 changed files
with
4 additions
and
1 deletions
Show diff stats
src/components/tree/node.vue
@@ -98,6 +98,7 @@ | @@ -98,6 +98,7 @@ | ||
98 | handleExpand () { | 98 | handleExpand () { |
99 | if (this.data.disabled) return; | 99 | if (this.data.disabled) return; |
100 | this.$set(this.data, 'expand', !this.data.expand); | 100 | this.$set(this.data, 'expand', !this.data.expand); |
101 | + this.dispatch('Tree', 'toggle-expand', this.data); | ||
101 | }, | 102 | }, |
102 | handleSelect () { | 103 | handleSelect () { |
103 | if (this.data.disabled) return; | 104 | if (this.data.disabled) return; |
src/components/tree/tree.vue
@@ -102,7 +102,6 @@ | @@ -102,7 +102,6 @@ | ||
102 | }, | 102 | }, |
103 | mounted () { | 103 | mounted () { |
104 | this.updateData(); | 104 | this.updateData(); |
105 | - | ||
106 | this.$on('selected', ori => { | 105 | this.$on('selected', ori => { |
107 | const nodes = findComponentsDownward(this, 'TreeNode'); | 106 | const nodes = findComponentsDownward(this, 'TreeNode'); |
108 | nodes.forEach(node => { | 107 | nodes.forEach(node => { |
@@ -119,6 +118,9 @@ | @@ -119,6 +118,9 @@ | ||
119 | this.$on('on-checked', () => { | 118 | this.$on('on-checked', () => { |
120 | this.$emit('on-check-change', this.getCheckedNodes()); | 119 | this.$emit('on-check-change', this.getCheckedNodes()); |
121 | }); | 120 | }); |
121 | + this.$on('toggle-expand', (payload) => { | ||
122 | + this.$emit('on-toggle-expand', payload); | ||
123 | + }); | ||
122 | }, | 124 | }, |
123 | watch: { | 125 | watch: { |
124 | data () { | 126 | data () { |