1,数据表格
<el-table
:data="tableData"
ref="multipleTable"
row-key="id" // 1,加id
stripe
style="width: 100%;"
v-loading="tableLoading"
@selection-change="handleSelectionChange" //2,该方法的参数为选中的rows
>
<el-table-column
type="selection"
reserve-selection // 3,加上该参数,保留勾选状态
width="55">
</el-table-column>
//------- 以下为自定义插槽--全选,当页------
<!-- <el-table-column width="100" fixed :reserve-selection="true">
<template #header>
<el-checkbox v-model="selectPage" @change="selectPageMethod()"
:disabled="selectAll">
{{ $t("common.selectCurrentPage") }}
</el-checkbox>
<el-checkbox
v-model="selectAll"
@change="selectAllMethod('handle')"
:disabled="selectPage"
>
{{ $t("common.selectAll") }}
</el-checkbox>
</template>
<template slot-scope="scope">
<el-checkbox
v-model="scope.row.checked"
@change="checkSingle(scope.row)"
/>
</template>
</el-table-column> -->
<el-table-column prop="companyCode" label="公司" show-overflow-tooltip>
</el-table-column>
</el-table>
//分页组件需要自定义
<pagination
v-show="paginationInfo.totalCount > 0"
:total="paginationInfo.totalCount"
:page.sync="paginationInfo.currentPage"
:limit.sync="paginationInfo.pageSize"
@pagination="paginationChange"
/>
2.清空复选框勾选状态:
this.$refs.multipleTable.clearSelection();