elementui表格实现单选

效果:

代码实现

<el-table v-loading="loading" :data="list" @row-click="rowClickHandle">
    <el-table-column width="50" align="center">
       <template slot-scope="scope">
            <el-radio :label="scope.row.id" v-model="radioId">{
   
   { '' }}</el-radio>
       </template>
    </el-table-column>
    <el-table-column label="序号" type="index" width="60px" />
</el-table>


rowClickHandle(row) {
    // row是选中行的数据
    this.radioId = row.id;
    this.selection = row;
},

猜你喜欢

转载自blog.csdn.net/m0_73533910/article/details/132598647