element里有一个 reserve-selection属性
设置以后就可以保留之前选中的选项,但还要设置row-key
代码如下:
<el-table
ref="mytable"
:data="HostRows"
border
v-loading="loading"
element-loading-text="正在加载中..."
@selection-change="SelectionChange"
:row-key="
(row)=>{
return row.ip
}
"
>
<el-table-column prop="ip" label="IP" align="center"></el-table-column>
<---其他--->
<el-table-column :reserve-selection='true' type="selection" width="45"></el-table-column>
</el-table>
🆗🦌