Merge pull request #516 from RickCole21/master

修复 Select 多选+autoComplete 时,重新拉取的问题
This commit is contained in:
liaoxuezhi 2020-04-01 12:40:06 +08:00 committed by GitHub
commit 1f11dc3003

View File

@ -453,9 +453,9 @@ export class Select extends React.Component<SelectProps, SelectState> {
} }
handleStateChange(changes: any) { handleStateChange(changes: any) {
const {multiple, checkAll} = this.props; const {multiple, checkAll, loadOptions} = this.props;
let {inputValue} = this.state;
let update: any = {}; let update: any = {};
const loadOptions = this.props.loadOptions;
let doLoad = false; let doLoad = false;
switch (changes.type) { switch (changes.type) {
@ -464,9 +464,10 @@ export class Select extends React.Component<SelectProps, SelectState> {
update = { update = {
...update, ...update,
isOpen: multiple ? true : false, isOpen: multiple ? true : false,
isFocused: multiple && checkAll ? true : false isFocused: multiple && checkAll ? true : false,
inputValue: !multiple ? '' : inputValue
}; };
doLoad = true; doLoad = !multiple;
break; break;
case DownshiftChangeTypes.changeInput: case DownshiftChangeTypes.changeInput:
update.highlightedIndex = 0; update.highlightedIndex = 0;