How to dynamically control the full folding and expansion of the tree by element-ui

1. Click the button to expand all, and then el-tree will expand all
2. Click the button to collapse all, and then el-tree collapses all
3. Use: default-expand-all= "isExpand", dynamically change the value of isExpand, the value changes, but the tree does not change
4. How do you make it happen?
html Code:
< 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 Code:

  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;
  }
},
Mar.20,2021

this.$refs.tree2.$el has a tree structure inside, you can find the operation you want


for(var i=0;i<this.$refs.treeX.store._getAllNodes().length;iPP){
           this.$refs.treeX.store._getAllNodes()[i].expanded=this.isexpand;
        }
    this.$refs.treeXexpandtruefalseid

has the third problem been solved

Menu