<el-table
ref="moduleTableRef"
v-loading="loading"
:data="moduleListPaging"
class="dataTable"
row-key="id"
highlight-current-row
row-class-name="rowClassName"
@row-click="handleRowClick"
@selection-change="handleSelectionChange">
<!-- 实现多选: 手动添加一个 el-table-column,设 type 属性为 selection 即可 -->
<el-table-column type="selection" :reserve-selection="true" />
<el-table-column label="模块" prop="module_name" />
<!-- ...省略其它列 -->
</el-table>
两处关键代码:
1. 在 el-table 元素中添加 row-key 属性作为标识
2. 仅在实现多选的 el-table-column 中添加 :reserve-selection="true"