1.点击按钮,全部展开,然后el-tree则全部展开
2.点击按钮,全部折叠,然后el-tree则全部折叠
3.使用 :default-expand-all="isExpand",动态改变isExpand的值,值变化,树却没有变化
4.怎么实现?
html代码:
<el-tree
class="filter-tree treeoverflow"
:data="data2"
:props="defaultProps"
highlight-current
:filter-node-method="filterNode"
@node-click="handleNodeClick"
:default-expand-all="isExpand"
ref="tree2">
</el-tree>
js代码:
isExpand(){
console.log('执行isExpand()');
this.czlx=this.$store.state.ysml.czlx;
if( this.czlx=='111') {
console.log("全部折叠"+this.czlx);
this.iscolspann=false;
return false;
}else if( this.czlx=='222'){
console.log("全部展开");
this.iscolspann=true;
return true;
}else{
return false;
}
},
哔哔one
aluckdog
相关分类