fix: radioGroup not take effect when value is the number 0 #226
parent
1ab2e106bf
commit
46b71b2e0a
|
@ -4,18 +4,6 @@ import Radio from './Radio'
|
||||||
import { getOptionProps, filterEmpty, hasProp } from '../_util/props-util'
|
import { getOptionProps, filterEmpty, hasProp } from '../_util/props-util'
|
||||||
function noop () {}
|
function noop () {}
|
||||||
|
|
||||||
function getCheckedValue (children) {
|
|
||||||
let value = null
|
|
||||||
let matched = false
|
|
||||||
children.forEach((radio) => {
|
|
||||||
if (radio && radio.componentOptions && radio.componentOptions.propsData.checked) {
|
|
||||||
value = radio.componentOptions.propsData.value
|
|
||||||
matched = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return matched ? { value } : undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ARadioGroup',
|
name: 'ARadioGroup',
|
||||||
props: {
|
props: {
|
||||||
|
@ -42,7 +30,7 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
const { value, defaultValue } = this
|
const { value, defaultValue } = this
|
||||||
return {
|
return {
|
||||||
stateValue: value || defaultValue,
|
stateValue: value === undefined ? defaultValue : value,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
|
|
Loading…
Reference in New Issue