avue element-ui表格子节点子项懒加载实时刷新

 在data中定义:

 maps: new Map(),

    treeLoad(tree, treeNode, resolve) {
      this.maps.set("parentId", { tree, treeNode, resolve })
      setTimeout(() => {
        resolve(this.list)
      }, 1000)
      console.log('id',tree.id)
      getListhoslazy(tree.id).then(res=>{
            console.log('res111',res)
            this.list = res.data.data;
          
          })
    },
//子节点刷新
    updateTable() { // 在删除或者添加操作成功之后,调用此函数
      this.maps.forEach((item, key) => {
        const { tree, treeNode, resolve } = this.maps.get(key)
        this.treeLoad(tree, treeNode, resolve)
      })
    }

 在修改子项后调用子节点刷新

你可能感兴趣的:(vue,javascript,前端,html)