mirror of https://github.com/ElemeFE/element
Tree: fix defaultCheckedKeys and emptyText bug (#11971)
parent
5e32b4c772
commit
b18642f716
|
@ -18,7 +18,7 @@
|
||||||
:render-content="renderContent"
|
:render-content="renderContent"
|
||||||
@node-expand="handleNodeExpand">
|
@node-expand="handleNodeExpand">
|
||||||
</el-tree-node>
|
</el-tree-node>
|
||||||
<div class="el-tree__empty-block" v-if="!root.childNodes || root.childNodes.length === 0">
|
<div class="el-tree__empty-block" v-if="isEmpty">
|
||||||
<span class="el-tree__empty-text">{{ emptyText }}</span>
|
<span class="el-tree__empty-text">{{ emptyText }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
@ -141,12 +141,16 @@
|
||||||
|
|
||||||
treeItemArray() {
|
treeItemArray() {
|
||||||
return Array.prototype.slice.call(this.treeItems);
|
return Array.prototype.slice.call(this.treeItems);
|
||||||
|
},
|
||||||
|
|
||||||
|
isEmpty() {
|
||||||
|
const { childNodes } = this.root;
|
||||||
|
return !childNodes || childNodes.length === 0 || childNodes.every(({visible}) => !visible);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
defaultCheckedKeys(newVal) {
|
defaultCheckedKeys(newVal) {
|
||||||
this.store.defaultCheckedKeys = newVal;
|
|
||||||
this.store.setDefaultCheckedKey(newVal);
|
this.store.setDefaultCheckedKey(newVal);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue