vue+elementUI中el-radio设置默认值
如果后台返回的单选框的值是number:单选框的lable需要设置成 :lable=‘0’;如下:<el-form-item label="仿牌选项:" prop="ifCod" size="mini" class='form-label'><div id='radio' ><el-radio class='m0' :disabled="disab...
·
- 如果后台返回的单选框的值是number:单选框的lable需要设置成 :lable=‘0’;如下:
<el-form-item label="仿牌选项:" prop="ifCod" size="mini" class='form-label'>
<div id='radio' >
<el-radio class='m0' :disabled="disable" v-model="form.ifCod" :label="0" >普货</el-radio>
<el-radio class='m0' :disabled="disable" v-model="form.ifCod" :label="1" >仿牌</el-radio>
</div>
</el-form-item>
data(){
return {
form:{
ifCode:0
}
}
}
- 后台返回的是字符串 则正常写;
<el-form-item label="仿牌选项:" prop="ifCod" size="mini" class='form-label'>
<div id='radio' >
<el-radio class='m0' :disabled="disable" v-model="form.ifCod" label="0" >普货</el-radio>
<el-radio class='m0' :disabled="disable" v-model="form.ifCod" label="1" >仿牌</el-radio>
</div>
</el-form-item>
data(){
return {
form:{
ifCode:'0'
}
}
}
更多推荐
已为社区贡献4条内容
所有评论(0)