el-tree的全部展开/收缩

应用于vue
展开

Expand() {
      debugger;
      this.$nextTick(() => {
        debugger;
        for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
          debugger;
          this.$refs.tree.store._getAllNodes()[i].expanded = true;
        }
      });
    },

收起

shrink() {
      this.$nextTick(() => {
        debugger;
        for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
          debugger;
          this.$refs.tree.store._getAllNodes()[i].expanded = false;
        }
      });
    },

你可能感兴趣的:(前端)