Fix CheckboxGroup initialValue, close #1631

This commit is contained in:
afc163 2016-05-11 11:30:10 +08:00
parent f7c9e64416
commit d57632ca5b
2 changed files with 7 additions and 12 deletions

View File

@ -17,9 +17,9 @@ export default class CheckboxGroup extends React.Component {
super(props);
let value;
if ('value' in props) {
value = props.value;
value = props.value || [];
} else if ('defaultValue' in props) {
value = props.defaultValue;
value = props.defaultValue || [];
}
this.state = { value };
}

View File

@ -14,16 +14,11 @@ function onChange(checkedValues) {
}
const plainOptions = ['Apple', 'Pear', 'Orange'];
const options = [{
label: '苹果',
value: 'Apple',
}, {
label: '梨',
value: 'Pear',
}, {
label: '橘',
value: 'Orange',
}];
const options = [
{ label: '苹果', value: 'Apple' },
{ label: '梨', value: 'Pear' },
{ label: '橘', value: 'Orange' },
];
const optionsWithDisabled = [
{ label: '苹果', value: 'Apple' },
{ label: '梨', value: 'Pear' },