el中selection分页时继续保持上一页选中的状态 并取消选中状态

el中selection分页时继续保持上一页选中的状态 并取消选中状态

table中写上row-key type = 'selection' 中写上 :reserve-selection="true"

<el-table :data="tableData" style="width: 100%; color: #333" :header-cell-style="{ color: '#4E89FF' }"
          v-loading="loading"  ref="recordTable"   @selection-change="handleSelectionChange"  row-key="orderId">
          <el-table-column type="selection" width="55" :reserve-selection="true">
          </el-table-column>
</el-table>

但是查询的时候不想保持状态,起初的思路是将 reserve-selection="false" 但是失败了,

成功用法用 this.$refs.recordTable.clearSelection();

posted @ 2023-03-09 20:53  张尊娟  阅读(118)  评论(0编辑  收藏  举报