mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 11:28:30 +08:00
修复 picker 内嵌模式选中卡死问题
This commit is contained in:
parent
8de040ac9f
commit
bbb431600d
@ -15,7 +15,8 @@ import {
|
||||
getScrollParent,
|
||||
difference,
|
||||
noop,
|
||||
autobind
|
||||
autobind,
|
||||
isArrayChilrenModified
|
||||
} from '../utils/helper';
|
||||
import {resolveVariable} from '../utils/tpl-builtin';
|
||||
import {
|
||||
@ -333,7 +334,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
) {
|
||||
Table.syncRows(store, nextProps, props);
|
||||
this.syncSelected();
|
||||
} else if (props.selected !== nextProps.selected) {
|
||||
} else if (isArrayChilrenModified(props.selected, nextProps.selected)) {
|
||||
store.updateSelected(nextProps.selected || [], nextProps.valueField);
|
||||
this.syncSelected();
|
||||
}
|
||||
|
@ -85,6 +85,9 @@ export const FormItemStore = types
|
||||
return self.errorData.map(item => item.msg);
|
||||
}
|
||||
|
||||
let lastQueryValue: any;
|
||||
let lastResult: any = [];
|
||||
|
||||
return {
|
||||
get form(): any {
|
||||
return getForm();
|
||||
@ -114,8 +117,13 @@ export const FormItemStore = types
|
||||
},
|
||||
|
||||
getSelectedOptions: (value: any = getValue()) => {
|
||||
if (value === lastQueryValue) {
|
||||
return lastResult;
|
||||
}
|
||||
lastQueryValue = value;
|
||||
|
||||
if (typeof value === 'undefined') {
|
||||
return [];
|
||||
return (lastResult = []);
|
||||
}
|
||||
|
||||
const selected = Array.isArray(value)
|
||||
@ -175,7 +183,7 @@ export const FormItemStore = types
|
||||
unMatched && selectedOptions.push(unMatched);
|
||||
});
|
||||
|
||||
return selectedOptions;
|
||||
return (lastResult = selectedOptions);
|
||||
}
|
||||
};
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user