zoukankan      html  css  js  c++  java
  • elementUI表格组件中懒加载子级即时更新的问题(添加、删除、修改)

    遇到的问题:elementUI表格组件中,更新数据后,懒加载的数据没有即时更新。

    前端代码:

    <el-table
              :data="dataList"
              ref="dataTable"
              style=" 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表格的懒加载树中的子节点进行了手动更新。

  • 相关阅读:
    pymysql
    flask WTForms
    线程安全问题
    flask学习2
    @functools.wraps(func)
    Solidity开发神器Remix
    Web3j实现智能合约
    基于Ubuntu Docker环境下进行以太坊实践
    以太坊RLP机制分析
    以太坊网络服务分析
  • 原文地址:https://www.cnblogs.com/jeacy/p/15739392.html
Copyright © 2011-2022 走看看