el-tree全部展開全部摺疊方法

hello芳芳發表於2024-07-19
// 摺疊所有節點
setAllFold() {
  for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
    this.$refs.tree.store._getAllNodes()[i].expanded = false;
  }
},
// 展開所有節點
setAllExpand() {
  for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
    this.$refs.tree.store._getAllNodes()[i].expanded = true;
  }
}

相關文章