mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 21:49:09 +08:00
reload 逻辑优化
This commit is contained in:
parent
e67a89f931
commit
a66f993b77
@ -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