mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
Select autoComplet 支持配置 sendOn
This commit is contained in:
parent
f72b7f9ffc
commit
d497256005
@ -141,31 +141,29 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
||||
options: combinedOptions
|
||||
});
|
||||
}
|
||||
const ctx = createObject(data, {
|
||||
term: input,
|
||||
value: input
|
||||
});
|
||||
|
||||
if (!isEffectiveApi(autoComplete, ctx)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
return (
|
||||
isEffectiveApi(autoComplete, data) &&
|
||||
env
|
||||
.fetcher(
|
||||
autoComplete,
|
||||
createObject(data, {
|
||||
term: input,
|
||||
value: input
|
||||
})
|
||||
)
|
||||
.then(ret => {
|
||||
let options =
|
||||
(ret.data && (ret.data as any).options) || ret.data || [];
|
||||
this.cache[input] = options;
|
||||
let combinedOptions = this.mergeOptions(options);
|
||||
setOptions(combinedOptions);
|
||||
return env
|
||||
.fetcher(autoComplete, ctx)
|
||||
.then(ret => {
|
||||
let options = (ret.data && (ret.data as any).options) || ret.data || [];
|
||||
this.cache[input] = options;
|
||||
let combinedOptions = this.mergeOptions(options);
|
||||
setOptions(combinedOptions);
|
||||
|
||||
return Promise.resolve({
|
||||
options: combinedOptions
|
||||
});
|
||||
})
|
||||
.finally(() => setLoading(false))
|
||||
);
|
||||
return Promise.resolve({
|
||||
options: combinedOptions
|
||||
});
|
||||
})
|
||||
.finally(() => setLoading(false));
|
||||
}
|
||||
|
||||
mergeOptions(options: Array<object>) {
|
||||
|
Loading…
Reference in New Issue
Block a user