<el-table-column
label="单选框"
width="50px"
align="center"
header-align="center"
>
<template slot-scope="scope">
<el-radio
:label="scope.row.id"
v-model="scopeRadio"
@change.native="getScopeRow(scope.$index, scope.row)"
style="margin-left: 10px"
> </el-radio
>
</template>
</el-table-column>
data(){
return{
scopeRadio:false,
templateSelection:{}
}
}
methods:{
getScopeRow(index, row) {
this.templateSelection = row;
},
}
本文介绍如何在Vue项目中实现带有单选框的表格组件。通过使用Element UI库中的`el-table-column`标签,结合`el-radio`组件完成行数据的选择功能,并通过`v-model`和`@change.native`事件进行状态管理和事件监听。
6954

被折叠的 条评论
为什么被折叠?



