Browse Source

CheckboxGroup onChange 值保持选项的顺序

pull/17342/head
yoyo837 5 years ago
parent
commit
32bb62be15
  1. 4
      components/checkbox/Group.tsx

4
components/checkbox/Group.tsx

@ -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…
Cancel
Save