vue3 elementPlus 翻页默认选中
原创
©著作权归作者所有:来自51CTO博客作者@大众创业的原创作品,请联系作者获取转载授权,否则将追究法律责任
1、html
<el-table
:data="tableData"
@selection-change="handleSelectionChange"
class="my-table"
:row-key="getRowKeys"
border
v-loading="loading"
highlight-current-row
ref="multipleTableRef"
:header-cell-style="{
background: 'var(--el-fill-color-light)',
}"
>
<el-table-column
:reserve-selection="true"
type="selection"
width="55"
/>
<el-table-column
align="center"
prop="billNo"
label="票据号码"
width="300"
/>
</el-table>
2、js
const multipleTableRef = ref(null);
const handleSelectionChange = (val) => {
console.log(val)
state.multipleSelection = val;
};
const getRowKeys = (row) => {
return row.id;
};