Skip to content

Commit bd3bb02

Browse files
author
undefined
committed
fix: select cannot open #3070
1 parent 9380621 commit bd3bb02

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

components/vc-select/Selector/Input.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface InputProps {
3535
onCompositionend: EventHandlerNonNull;
3636
}
3737

38-
const Input = defineComponent<InputProps, { VCSelectContainerEvent: any }>({
38+
const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTimeout: any }>({
3939
name: 'Input',
4040
inheritAttrs: false,
4141
setup(props) {
@@ -50,6 +50,7 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any }>({
5050
});
5151
}
5252
return {
53+
blurTimeout: null,
5354
VCSelectContainerEvent: inject('VCSelectContainerEvent'),
5455
};
5556
},
@@ -141,10 +142,13 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any }>({
141142
},
142143
onPaste,
143144
onFocus: (...args: any[]) => {
145+
clearTimeout(this.blurTimeout);
144146
this.VCSelectContainerEvent?.focus(args[0]);
145147
},
146148
onBlur: (...args: any[]) => {
147-
this.VCSelectContainerEvent?.blur(args[0]);
149+
this.blurTimeout = setTimeout(() => {
150+
this.VCSelectContainerEvent?.blur(args[0]);
151+
}, 200);
148152
},
149153
},
150154
inputNode.type === 'textarea' ? {} : { type: 'search' },

0 commit comments

Comments
 (0)