其他分享
首页 > 其他分享> > vue element-ui tree 根节点固定子节点懒加载 首次加载根节点并展开

vue element-ui tree 根节点固定子节点懒加载 首次加载根节点并展开

作者:互联网

关键代码:

  <el-tree ref="foldTree" node-key="id" :highlight-current="true" :props="defaultProps" lazy :load="handLoadNode" @node-click="handleNodeClick" />

  

 

data() {
    return {
      CurrentNode: null,
      CurrentNodeResolve: null,
      RootNode: { id: "000", Name: "根目录", Path: "" },
    }
  },

  

mounted() {
    var _rNode = this.CurrentNode.childNodes[0];
    _rNode.checked = true;
    _rNode.expanded = true;
    _rNode.loadData();
  }

  

 handLoadNode(node, resolve) {
      this.CurrentNodeResolve = resolve;
      this.CurrentNode = node;
      if (node.level === 0) {
        return resolve([this.RootNode]);
      } else {
        ...
        }
}    

  

标签:node,resolve,CurrentNode,rNode,vue,RootNode,节点,加载
来源: https://www.cnblogs.com/yesicoo/p/11002638.html