mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
CheckboxGroup onChange 值保持选项的顺序
This commit is contained in:
parent
4463d24660
commit
32bb62be15
@ -136,7 +136,9 @@ class CheckboxGroup extends React.Component<CheckboxGroupProps, CheckboxGroupSta
|
||||
}
|
||||
const onChange = this.props.onChange;
|
||||
if (onChange) {
|
||||
onChange(value.filter(val => registeredValues.indexOf(val) !== -1));
|
||||
const values = value.filter(val => registeredValues.indexOf(val) !== -1);
|
||||
const options = this.getOptions();
|
||||
onChange(options.map(opt => values.includes(opt.value)));
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user