elementUI table-tree

默认展开第一级

updated() {
	if (this.isExpand) {
	    this.expandAll()
	    this.isExpand = false
	}
},
expandAll() {
    const els = this.$el.getElementsByClassName('el-table__expand-icon')
    for (let i = 0; i < els.length; i++) {
        els[i].click()
    }
},

加载树表格数据

load(tree, treeNode, resolve) {
const pid = tree.id;
this.maps.set(pid, { tree, treeNode, resolve })
tree.hasChildren = true
resolve(data)

  1. 更新数据
if (this.maps.get(pId)) {
        const { tree, treeNode, resolve } = this.maps.get(pId)
         // let source = this.$refs.singleTable.store.states.lazyTreeNodeMap[pid]
         // this.$set(this.$refs.singleTable.store.states.lazyTreeNodeMap, pid, [...source, ...data])
        this.$set(this.$refs.singleTable.store.states.lazyTreeNodeMap, pid, []) //delete
        this.load(tree, treeNode, resolve);
}
发布了5 篇原创文章 · 获赞 0 · 访问量 99
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览