element-UI树形table父子级全选

时间:2020-11-19 22:08:16   收藏:0   阅读:568
 @select-all="selectAll" ref="multipleTable"
在table里进行绑定

checkedKeys: false,
在data里进行声明

 selectAll() {
      this.checkedKeys = !this.checkedKeys;
      this.splite(this.tableData, this.checkedKeys);
    },
    /**
     * 处理数据
     */
    splite(data, flag) {
      data.forEach((row) => {
        this.$refs.multipleTable.toggleRowSelection(row, flag);
        if (row.children != undefined) {
          this.splite(row.children);
        }
      });
    },
method里进行声明

 

原文:https://www.cnblogs.com/hurenjie/p/14007558.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!