element 树表格重渲染子节点


data(){

loadNodeMap: new Map(),

}

// 加载子节点
loadChild (tree, treeNode, resolve) {
  this.loadNodeMap.set(tree.id, {tree, treeNode, resolve})
   。。。。省略
  resolve(children)
},

增加:新增节点一级可直接刷新;

新增二级根据当前节点获取请求数据后

this.currentRow.hasChildren = true
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, this.currentRow.id, 根据当前节点查找接口返回来的children)
更新:当前节点一级可直接刷新;
   非一级获取父级节点
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, this.currentRow.parentId, 根据当前节点父节点查找接口返回来的children)
删除:当前节点一级可直接刷新;
    非一级获取父级节点
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, this.currentRow.parentId, 根据当前节点父节点查找接口返回来的children)
const {tree, treeNode, resolve} = this.loadNodeMap.get(this.currentRow.parentId)
resolve(根据当前节点父节点查找接口返回来的children)
 if (children.length < 1) {
        tree.hasChildren = false
}
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM