1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > vue3.0的el-table的多选切换分页保留选中的数据

vue3.0的el-table的多选切换分页保留选中的数据

时间:2023-07-20 22:20:03

相关推荐

vue3.0的el-table的多选切换分页保留选中的数据

1.在selection行加设置属性reserve-selection为true

2.在el-table 设置row-key

<el-table :data="list" @selection-change="handleSelectionChange"class="mt-16 factory-table normal-size" v-loading="loading" :row-key="getRowKey"><template #empty><empty-box class="mt-44" /></template><el-table-column type="selection" width="70" :reserve-selection="true"/><el-table-column prop="avatar" label="头像" /></el-table>

ts 设置row-key 的值

const handleSelectionChange = (val: any) => {multipleSelection.value = val}const getRowKey = (row: any) => {return row.user_id}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。