其他分享
首页 > 其他分享> > 2021-01-20

2021-01-20

作者:互联网

el-table 换页保持选中

<el-table
      :row-key="(row) => row.accountId"
      ref="multipleTable"
      :data="tableData"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" :reserve-selection="true" width="55">
      </el-table-column>
 	...........
    </el-table>
  1. 首先在el-table加上行唯一id :row-key="(row) => row.accountId" 注:accountId不是指定,是根据该行唯一值
  2. 在选项列中加上 :reserve-selection=“true”
    3.清楚已保存的默认选中状态
 this.$refs.multipleTable.clearSelection();

标签:el,multipleTable,01,20,selection,2021,table,row,accountId
来源: https://blog.csdn.net/MarsDMC/article/details/112862418