Vue el-tree 清空数据
<el-tree:props="props":load="loadNode"ref="tree"lazyaccordion@node-click="handleNodeClick"></el-tree>export default {data() {return {node_had: undefined,resolve_had : undefined}.
·
<el-tree
:props="props"
:load="loadNode"
ref="tree"
lazy
accordion
@node-click="handleNodeClick">
</el-tree>
export default {
data() {
return {
node_had: undefined,
resolve_had : undefined
}
}
methods: {
loadNode(node, resolve) {
if (node.level === 0) {
this.node_had = node // 保存一下根节点
this.resolve_had = resolve // 保存一下根节点
console.log('节点是根节点id=' + this.rootId +' 名字====' + this.rootName);
return resolve([{ MDM_ORG_CODE:this.rootId,ORG_NAME: this.rootName }]);
}else{
console.log("获取到的node=" + node.data.MDM_ORG_CODE);
let paraobj = node.data.MDM_ORG_CODE ;
this.commonSearchT(paraobj, resolve);
}
},
clearTree(){// 清空树的方法
this.node_had.childNodes = [];
this.loadNode(this.node_had, this.resolve_had); //再次执行懒加载的方法
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)