el-radio是要传给后端的字段名
html
<el-table :data="tableData" class="table" ref="table"
height="485px" :row-key="(row) => row.id" @row-click="rowClick">
<el-table-column label="选择" width="55" align="center">
<template slot-scope="scope">
<el-radio :label="scope.row.num" v-model="tableRadio">{{ '' }}
</el-radio>
</template>
</el-table-column>
</el-table>
javascript
data() {
return {
tableData: [],
tableRadio: "",
};
},
val.xxx赋值为需要传给后端的字段名
javascript
// 选择项目 单选样式
rowClick(val) {
this.tableRadio = val.num
;
},
隐藏调radio label的显示
css
.el-radio__label {
display: none;
}
回显:
javascript
this.tableRadio = xxx; //直接赋值