Skip to content

Commit

Permalink
fix: 修复输入框在中文输入过程中如果被重渲染打断可能无法输入 (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchun authored Dec 5, 2024
1 parent 8029e7c commit 803d9b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/_util/use/useInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { ref } from 'vue';
export function useInput(updateValue: (val: string) => void) {
const isComposing = ref(false);
const handleInput = (event: Event | string) => {
if (event instanceof InputEvent && !event.isComposing) {
isComposing.value = false;
}
if (!isComposing.value) {
if (event instanceof Event) {
const { value } = event.target as HTMLInputElement;
Expand Down
3 changes: 3 additions & 0 deletions components/select-trigger/selectTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ export default defineComponent({
};
const handleInput = (e: Event) => {
if (e instanceof InputEvent && !e.isComposing) {
isComposingRef.value = false;
}
if (props.disabled || isComposingRef.value) {
return;
}
Expand Down

0 comments on commit 803d9b2

Please sign in to comment.