mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-19 12:04:02 +08:00
[tree]:add node-expand and node-collapse event
This commit is contained in:
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user