Skip to content

Commit

Permalink
fix: select cannot open #3070
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined committed Nov 1, 2020
1 parent 9380621 commit bd3bb02
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/vc-select/Selector/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface InputProps {
onCompositionend: EventHandlerNonNull;
}

const Input = defineComponent<InputProps, { VCSelectContainerEvent: any }>({
const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTimeout: any }>({
name: 'Input',
inheritAttrs: false,
setup(props) {
Expand All @@ -50,6 +50,7 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any }>({
});
}
return {
blurTimeout: null,
VCSelectContainerEvent: inject('VCSelectContainerEvent'),
};
},
Expand Down Expand Up @@ -141,10 +142,13 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any }>({
},
onPaste,
onFocus: (...args: any[]) => {
clearTimeout(this.blurTimeout);
this.VCSelectContainerEvent?.focus(args[0]);
},
onBlur: (...args: any[]) => {
this.VCSelectContainerEvent?.blur(args[0]);
this.blurTimeout = setTimeout(() => {
this.VCSelectContainerEvent?.blur(args[0]);
}, 200);
},
},
inputNode.type === 'textarea' ? {} : { type: 'search' },
Expand Down

0 comments on commit bd3bb02

Please sign in to comment.