打开/node_modules/uview-ui/components/u-radio/u-radio.vue找到setRadioCheckedStatus函数修改为
setRadioCheckedStatus() {
this.emitEvent()
// 将本组件标记为选中状态
this.checked = !this.checked
typeof this.parent.unCheckedOther === 'function' && this.parent.unCheckedOther(this)
}
2.打开/node_modules/uview-ui/components/u-radio-group/u-radio-group.vue找到unCheckedOther函数修改为
unCheckedOther(childInstance) {
this.children.map(child => {
// 所有子radio中,被操作组件实例的checked的值无需修改
if (childInstance !== child) {
child.checked = false
}
})
const {
name
} = childInstance
let bool = false
this.children.forEach(item=>{
if(item.checked==true){
bool = true
}
})
if(bool){
this.$emit('input', name)
// 发出事件
this.$emit('change', name)
}else{
this.$emit('input', null)
// 发出事件
this.$emit('change', null)
}
}