el-table 实现自定义单选
- 示例图片
- 代码
示例图片
代码
@row-click="singleElection"
<el-table-column
align="center"
label="选择"
>
<template slot-scope="scope">
<el-radio
:key="scope.row.id"
v-model="templateSelection"
class="radio"
:label="scope.row.id"
>
</el-radio>
</template>
</el-table-column>
singleElection(row) {
this.templateSelection = row.id;
const checkList = this.crud.data.filter(item => item.id === row.id);
}