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