element table跨分页多选及回显的实现示例

1.data中定义getRowKeys,记录每行的key值

getRowKeys(row) {
   return row.id;
},

2.el-table绑定getRowKeys

3.将selection列的reserve-selection设为true

4.表格数据选中方法handleSelectionChange

handleSelectionChange(rows) {
    this.multipleSelection = rows;
    this.select_number = this.multipleSelection.length;
    this.select_Id = [];
    if (rows) {
        rows.forEach((row) => {
          if (row) {
            this.select_Id.push(row.id);
          }
        });
    }
},

代码整理



                    
                    

你可能感兴趣的:(element table跨分页多选及回显的实现示例)