遇到的问题: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表格的懒加载树中的子节点进行了手动更新。

 

相关文章:

  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-10-04
  • 2022-01-08
  • 2022-12-23
  • 2022-01-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
相关资源
相似解决方案