el table 分页切换时默认打钩select项,状态被清空,请问谁遇到过这样的情况
<el-table ref="singleTable" @selection-change='selectCall' :data="tableData.slice((currentPage-1)*pagesize,currentPage*pagesize)" highlight-current-row style="width: 97%;margin: 10px auto;">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column property="code" label="属性编码" width="120" > </el-table-column>
<el-table-column property="name" label="属性名称" width="120"> </el-table-column>
<el-table-column property="unit" label="数量"></el-table-column>
<el-table-column property="unit" label="单位"></el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :total="total" @current-change="current_change" style="padding-bottom:12px;float:right;">
</el-pagination>
//默认打钩回显方法
this.multipleSelection.forEach(itemMul => {
this.$refs.singleTable.toggleRowSelection(
this.tableData.find(d => d.code === itemMul.code),
true
);
});
搞那么复杂干嘛,ele都帮你实现了,复选框列加上reserve-selection属性,妥妥的