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;
};

 

posted @ 2022-11-17 16:56  浮生如梦似离殇  阅读(663)  评论(0编辑  收藏  举报