mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
reload 逻辑优化
This commit is contained in:
parent
0e6c25688f
commit
8342483776
@ -429,7 +429,6 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
const {source, formItem, data, onChange} = this.props;
|
||||
|
||||
if (
|
||||
config.autoLoadOptionsFromSource === false ||
|
||||
!formItem ||
|
||||
!isEffectiveApi(source, data)
|
||||
) {
|
||||
|
@ -134,9 +134,23 @@ export default class PickerControl extends React.PureComponent<
|
||||
};
|
||||
}
|
||||
|
||||
crud: any;
|
||||
|
||||
@autobind
|
||||
crudRef(ref: any) {
|
||||
while (ref && ref.getWrappedInstance) {
|
||||
ref = ref.getWrappedInstance();
|
||||
}
|
||||
this.crud = ref;
|
||||
}
|
||||
|
||||
reload() {
|
||||
const reload = this.props.reloadOptions;
|
||||
reload && reload();
|
||||
if (this.crud) {
|
||||
this.crud.search();
|
||||
} else {
|
||||
const reload = this.props.reloadOptions;
|
||||
reload && reload();
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
@ -341,7 +355,8 @@ export default class PickerControl extends React.PureComponent<
|
||||
valueField,
|
||||
options: options,
|
||||
multiple,
|
||||
onSelect: embed ? this.handleChange : undefined
|
||||
onSelect: embed ? this.handleChange : undefined,
|
||||
ref: this.crudRef
|
||||
}) as JSX.Element;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user