Skip to content

Commit 46b71b2

Browse files
committed
fix: radioGroup not take effect when value is the number 0 #226
1 parent 1ab2e10 commit 46b71b2

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

Diff for: components/radio/Group.jsx

+1-13
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@ import Radio from './Radio'
44
import { getOptionProps, filterEmpty, hasProp } from '../_util/props-util'
55
function noop () {}
66

7-
function getCheckedValue (children) {
8-
let value = null
9-
let matched = false
10-
children.forEach((radio) => {
11-
if (radio && radio.componentOptions && radio.componentOptions.propsData.checked) {
12-
value = radio.componentOptions.propsData.value
13-
matched = true
14-
}
15-
})
16-
return matched ? { value } : undefined
17-
}
18-
197
export default {
208
name: 'ARadioGroup',
219
props: {
@@ -42,7 +30,7 @@ export default {
4230
data () {
4331
const { value, defaultValue } = this
4432
return {
45-
stateValue: value || defaultValue,
33+
stateValue: value === undefined ? defaultValue : value,
4634
}
4735
},
4836
model: {

0 commit comments

Comments
 (0)