diff --git a/src/components/tree/node.vue b/src/components/tree/node.vue index b401ce57..4c7be821 100644 --- a/src/components/tree/node.vue +++ b/src/components/tree/node.vue @@ -98,6 +98,7 @@ handleExpand () { if (this.data.disabled) return; this.$set(this.data, 'expand', !this.data.expand); + this.dispatch('Tree', 'toggle-expand', this.data); }, handleSelect () { if (this.data.disabled) return; diff --git a/src/components/tree/tree.vue b/src/components/tree/tree.vue index 6f708b72..c0f7e968 100644 --- a/src/components/tree/tree.vue +++ b/src/components/tree/tree.vue @@ -102,7 +102,6 @@ }, mounted () { this.updateData(); - this.$on('selected', ori => { const nodes = findComponentsDownward(this, 'TreeNode'); nodes.forEach(node => { @@ -119,6 +118,9 @@ this.$on('on-checked', () => { this.$emit('on-check-change', this.getCheckedNodes()); }); + this.$on('toggle-expand', (payload) => { + this.$emit('on-toggle-expand', payload); + }); }, watch: { data () {