elementUI表格組件中懶加載子級即時更新的問題(添加、刪除、修改)


遇到的問題:elementUI表格組件中,更新數據后,懶加載的數據沒有即時更新。

 

前端代碼:

<el-table
          :data="dataList"
          ref="dataTable"
          style="width: 100%;"
          row-key="id"
          v-loading="dataListLoading"
          lazy
          :load="load"
          :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
</el-table>

 

對表格的子列進行添加操作后:

  if (val !== undefined) {
        let nodeMapVal = this.$refs.dataTable.store.states.lazyTreeNodeMap[val]
        if (nodeMapVal !== undefined && typeof nodeMapVal === 'object') {
          if (nodeMapVal.length > 0) {
            this.$http.get('URL路徑?id=' + val).then(({ data: res }) => {
              this.$refs.dataTable.store.states.lazyTreeNodeMap[val] = res.data
              this.query()
          })
        }
     }
  }

  

其中val即為id。本質上是對element表格的懶加載樹中的子節點進行了手動更新。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM