关键代码:
<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 {
...
}
}