mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
Fix CheckboxGroup initial state
This commit is contained in:
parent
5a032af8e9
commit
e539e08f4e
@ -16,10 +16,14 @@ export default React.createClass({
|
||||
onChange: React.PropTypes.func,
|
||||
},
|
||||
getInitialState() {
|
||||
const { value, defaultValue } = this.props;
|
||||
return {
|
||||
value: value || defaultValue,
|
||||
};
|
||||
const props = this.props;
|
||||
let value;
|
||||
if ('value' in props) {
|
||||
value = props.value;
|
||||
} else if ('defaultValue' in props) {
|
||||
value = props.defaultValue;
|
||||
}
|
||||
return { value };
|
||||
},
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if ('value' in nextProps) {
|
||||
|
Loading…
Reference in New Issue
Block a user