[tree]:add node-expand and node-collapse event

This commit is contained in:
张华焱
2017-01-24 10:37:44 +08:00
parent 46e83f4895
commit 8bf9c7d9ac
5 changed files with 11 additions and 9 deletions

View File

@@ -36,7 +36,7 @@
v-for="child in node.childNodes"
:key="getNodeKey(child)"
:node="child"
@node-expand="handleChildNodeExpand(child)">
@node-expand="handleChildNodeExpand">
</el-tree-node>
</div>
</collapse-transition>
@@ -146,10 +146,9 @@
handleExpandIconClick() {
if (this.expanded) {
this.tree.$emit('node-close', this.node.data, this.node, this);
this.tree.$emit('node-collapse', this.node.data, this.node, this);
this.node.collapse();
} else {
this.tree.$emit('node-open', this.node.data, this.node, this);
this.node.expand();
this.$emit('node-expand', this.node.data, this.node, this);
}
@@ -167,8 +166,9 @@
}
},
handleChildNodeExpand(node) {
handleChildNodeExpand(nodeData, node, instance) {
this.broadcast('ElTreeNode', 'tree-node-expand', node);
this.tree.$emit('node-expand', nodeData, node, instance);
}
},