1、HTML
<el-table ref="table" :data="tableData" class="single-select-table" @selection-change="handleSelectionChange">
<el-table-column type="selection" />
<!-- 其他列... -->
</el-table>
2、js
data(){
multipleSelection:[]
},
methods:{
// 表格勾选
handleSelectionChange(val) {
// 单选
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
}
this.multipleSelection = val
}
}
3、CSS
<style>
.single-select-table thead .el-table-column--selection .cell{
display: none;
}
</style>