fix: select cannot open #3070

pull/3087/head
undefined 2020-11-01 18:07:23 +08:00
parent 9380621850
commit bd3bb02c6e
1 changed files with 6 additions and 2 deletions

View File

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