mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-19 12:04:02 +08:00
Tree: add expand-on-click-node prop. (#1805)
This commit is contained in:
@@ -8,10 +8,10 @@
|
||||
'is-hidden': !node.visible
|
||||
}">
|
||||
<div class="el-tree-node__content"
|
||||
:style="{ 'padding-left': (node.level - 1) * 16 + 'px' }"
|
||||
@click="handleExpandIconClick">
|
||||
:style="{ 'padding-left': (node.level - 1) * 16 + 'px' }">
|
||||
<span
|
||||
class="el-tree-node__expand-icon"
|
||||
@click.stop="handleExpandIconClick"
|
||||
:class="{ 'is-leaf': node.isLeaf, expanded: !node.isLeaf && expanded }">
|
||||
</span>
|
||||
<el-checkbox
|
||||
@@ -131,19 +131,19 @@
|
||||
const store = this.tree.store;
|
||||
store.setCurrentNode(this.node);
|
||||
this.tree.$emit('current-change', store.currentNode ? store.currentNode.data : null, store.currentNode);
|
||||
this.tree.currentNode = this;
|
||||
if (this.tree.expandOnClickNode) {
|
||||
this.handleExpandIconClick(event);
|
||||
}
|
||||
this.tree.$emit('node-click', this.node.data, this.node, this);
|
||||
},
|
||||
|
||||
handleExpandIconClick(event) {
|
||||
let target = event.target;
|
||||
if (target.tagName.toUpperCase() !== 'DIV' &&
|
||||
target.parentNode.nodeName.toUpperCase() !== 'DIV' ||
|
||||
target.nodeName.toUpperCase() === 'LABEL') return;
|
||||
if (this.expanded) {
|
||||
this.node.collapse();
|
||||
} else {
|
||||
this.node.expand();
|
||||
}
|
||||
this.tree.$emit('node-click', this.node.data, this.node, this);
|
||||
},
|
||||
|
||||
handleUserClick() {
|
||||
|
||||
Reference in New Issue
Block a user