uniapp中单选框的代码
<radio-group @change="radioChange" class="value checked" style="font-size: 13px;">
<label class="radio">
<radio style="zoom: 0.8;" :color="roleColor" value="1" :checked="sex == '1'" />男
</label>
<label class="radio" style="margin-left: 15%;">
<radio style="zoom: 0.8;" :color="roleColor" value="2" :checked="sex == '2'" />女
</label>
</radio-group>
<script>
export default {
data() {
return {
// 单选框数据
sex: "", //存的是单选按钮选中的value值,性别值
}
},
methods: {
radioChange(evt) {
// console.log(evt);
this.sex = evt.detail.value;
},
}
</script>