diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index dc925d04..c79e394e 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -68,6 +68,7 @@ const multipleValue = ref([]); const emits = defineEmits(); const openState: Ref = ref(false); const options = ref([]); +const composing = ref(false); var timer: any; const getOption = (nodes: VNode[], newOptions: any[]) => { @@ -109,6 +110,15 @@ const handleRemove = (value: any) => { } }; +const onCompositionstart = () => { + composing.value = true; +}; + +const onCompositionend = (event: Event) => { + composing.value = false; + handleSearch((event.target as HTMLInputElement).value); +}; + onMounted(() => { intOption(); timer = setInterval(intOption, 500); @@ -155,6 +165,7 @@ const multiple = computed(() => { }); const handleSearch = (value: string) => { + if (composing.value) return; emits("search", value); searchValue.value = value; }; @@ -209,13 +220,15 @@ provide("multiple", multiple); @@ -230,9 +243,11 @@ provide("multiple", multiple);