elementUI表格中运⽤radio默认选中与取消
<el-table :data="logQueryDataaa" border highlight-current-row @row-click="clickrow">
<el-table-column width="55" align="center">
<template scope="scope">
<el-radio class="radio" v-model="radioData"  :label="w.userPhone" @change="changeUserPhone"></el-radio>
</template>
</el-table-column>
<el-table-column label="⼿机号" prop="userPhone" align="center" width="200"></el-table-column>
<el-table-column label="姓名" prop="userName" align="center" width="200"></el-table-column>
<el-table-column label="⾝份证号" prop="idCard" align="center" width="" ></el-table-column>
</el-table>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="sendNewDriver(logQueryDataaa)" >提交</el-button>
</div>
data(){
return{
logQueryDataaa:[],
radioData:''
}
},
methods: {
changeUserPhone(value){
/
/int类型转换为string
this.String();
},
htmlradio设置默认的按钮clickrow(row, event, column){
//获取所需id
this.radioId = row.id;
},
//更换司机
log_query_short_dataClick4(row, column, cellValue){
let param={uckId,companyId:rowpanySummaryId};
logQueryDriverImg(param)
.
then(res=>{
if(res.status==1){
this.sult;
for (let i=0; i&sult.length; i++){//是个数组所以取值时应先循环
if (this.driverPhone== sult[i].userPhone){//如果有对应的值则默认选中
this.changeUserPhone(this.driverPhone)
return;//不加return的话会重复判断导致⽆法选中
}else {//如果没有则没有选中
this.radioData='';
}
}
}else{
}
})
},}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。