selection-change:当选择项发生变化时会触发该事件(当分页切换时,选中的数据都会自动清空)
一、在el-table中添加 :row-key=“id”
<el-table :data="tableData" border style="width: 95%" @selection-change="handleSelectionChange" row-key="id">
二、在el-table-column中设置 type=“selection” 并且设置 :reserve-selection=“true”
<el-table-column type="selection" align="center" width="55" :reserve-selection="true"></el-table-column>