一、利用el-table自带方法selection-change(当选择项发生变化时触发该事件)
关键代码:this.$refs.serialnoTable.clearSelection() this.$refs.serialnoTable.toggleRowSelection(val.pop())
二、
1.将element中的 table 表格 组件中的 多选 代码,拷贝到自己的前端项目中:
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" >
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="日期" width="120">
<template slot-scope="scope">{{ scope.row.date }}</template>
</el-table-column>
<el-table-column prop="name" label="姓名" width="120"></el-table-column>
<el-table-column prop="address" label="地址" show-overflow-tooltip></el-table-column>
</el-table>
2.去除 表头出行 多选的勾选框,在 el-table 的标签中 加上样式 class = "table-style",从样式上隐藏 该全选的勾选框, 代码如下