vue3 elementPlus 翻页默认选中
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; };