<el-table ref="table" :data="tableData" border height="100%" :row-key="getRowKeys" @selection-change="handleSelectionChange"> </el-table>
关键代码:
1:
:row-key="getRowKeys" data里定义: data() { return { getRowKeys: (row) => {return row.id //唯一性
}, } } 2: <el-table-column type="selection" width="60" align="center" :reserve-selection="true"/> ========================以上 就实现了切换分页,选中效果还在================================= //选择改变
handleSelectionChange(e) {
this.selectedArray = e
}, //编辑时设置默认选中,很简单,循环选中的对象集合,调用方法设置成true
//设置默认选中 setCheckedItem(array) { this.selectedArray = array for (let item of this.selectedArray) { this.$refs.userTable.toggleRowSelection(item, true) } },
标签:el,分页,默认,选中,selectedArray,row From: https://www.cnblogs.com/jiangbeixiaoqiao/p/18037117