u-table使用虚拟表格 同时懒加载数据 处理 并且最子集 嵌套表格

大数据表格配置

     
      
              
              
            
            .
            .
          
              
            
            

以上是表格示例 ,下面是一些数据/事件

   data () {
   return {
          treeConfig: { hasChildren: 'hasChildren', expandAll: false, indent: 10,  children: 'children', lazy: true, iconOpen: 'el-icon-arrow-down', iconLoaded: 'el-icon-loading', iconClose: 'el-icon-arrow-right' }
    }
   },
   methods: {
    loadTree (row, resolve) {
    // 加载子节点数据的函数,lazy 为 true 时生效,函数第二个参数返回子节点
    },
    toggleTreeExpand (row) {
      const changeChildren = (row) => {
        if (row.children) {
          row.children.forEach((item) => {
            item.isOpen = false
            changeChildren(item)
          })
        }
      }
      changeChildren(row)
    },
   detail (row, column, event) {
      this.$nextTick(() => {
        this.findAccountingFileById(row)
      })
    },
    async findAccountingFileById (row) {
      this.$nextTick(async () => {
        let tableEl = this.$refs.controlTable
        if (row.isOpen) {
          row.isOpen = false
          tableEl.toggleRowExpansion(row, false)
        } else {
          const [err, res] = await 接口
          if (res) {
            tableEl.toggleRowExpansion(row, true)
            row.[嵌套表格数据命名]= res
          }
          this.$nextTick(() => {
            row.isOpen = !row.isOpen
          })
        }
      })
    },  
 
  }

如有疑问 加技术群 978165670 探讨

你可能感兴趣的:(umu-ui,u-table,vue.js,前端,javascript)