设置节点展开与选中:
let expandNode = this.$refs.treeLazy.getNode(data.data[0]);
expandNode.expand();
this.$refs.treeLazy.setCurrentNode(data.data[0]);
某个数据更新后要重新刷新树的数据:
if (this.$refs.treeLazy && this.$refs.treeLazy.root) {
this.$refs.treeLazy.root.loaded = false;
this.$refs.treeLazy.root.loadData();
}
单选树的节点,@check事件触发:
let nodeChecked = this.$refs.treeLazy.getNode(data).checked;
if (nodeChecked) {
this.$refs.treeLazy.setCheckedNodes([data]);
} else {
this.$refs.treeLazy.setCheckedNodes([]);
}
树节点按层数加载:
if (node.level === 0) {
resolve(data)
}
if (node.level === 1) {
resolve(data1);
}
if (node.level === 2) {
resolve([])
}