mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 20:39:07 +08:00
修复checkboxes拉取数据无法设置全选问题
This commit is contained in:
parent
a83d9a56bf
commit
9e64bb1ebb
@ -27,23 +27,11 @@ export default class CheckboxesControl extends React.Component<CheckboxesProps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps:OptionsControlProps) {
|
componentDidUpdate(prevProps:OptionsControlProps) {
|
||||||
let {options: currOptions, onToggleAll, checkAll, defaultCheckAll} = this.props;
|
let {options: currOptions, onToggleAll, defaultCheckAll} = this.props;
|
||||||
|
let {options: prevOptions} = prevProps;
|
||||||
|
|
||||||
if (checkAll && defaultCheckAll && currOptions.length) {
|
if (defaultCheckAll && prevOptions != currOptions) {
|
||||||
let {options: prevOptions} = prevProps;
|
onToggleAll();
|
||||||
|
|
||||||
if (prevOptions.length != currOptions.length) {
|
|
||||||
onToggleAll();
|
|
||||||
} else {
|
|
||||||
for(let i = 0, len = currOptions.length; i < len; i++) {
|
|
||||||
let diff = difference(prevOptions[i], currOptions[i]);
|
|
||||||
let hasDifference = Object.keys(diff).length;
|
|
||||||
if (hasDifference) {
|
|
||||||
onToggleAll();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user