Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Vue 3 debugging reference for reactivity issues, computed errors, watcher bugs, async failures, and SSR hydration problems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
reference/v-model-ime-composition.md
1---2title: v-model Does Not Update During IME Composition3impact: MEDIUM4impactDescription: v-model won't capture intermediate input for Chinese, Japanese, Korean and other IME languages5type: capability6tags: [vue3, v-model, forms, input, ime, internationalization, i18n, cjk]7---89# v-model Does Not Update During IME Composition1011**Impact: MEDIUM** - When users type in languages that require an Input Method Editor (Chinese, Japanese, Korean, etc.), v-model won't update until the composition is complete. This breaks real-time validation, character counters, and live search features for international users.1213IME (Input Method Editor) allows users to compose complex characters by typing multiple keystrokes. During this composition phase, v-model deliberately waits until the user confirms their selection before updating. This is usually desired, but can break features that need every keystroke.1415## Task Checklist1617- [ ] Test forms with IME input if your app serves CJK (Chinese, Japanese, Korean) users18- [ ] For real-time features (live search, character counters), use manual event binding instead of v-model19- [ ] Consider both behaviors when designing - sometimes waiting for composition completion IS correct20- [ ] Document expected behavior for international users2122**Problem - v-model waits for composition:**23```html24<script setup>25import { ref } from 'vue'2627const searchQuery = ref('')28const charCount = ref(0)29</script>3031<template>32<!-- PROBLEM: During IME composition, searchQuery won't update -->33<!-- Chinese user types "ni hao" -> sees no results until they press space/enter -->34<input v-model="searchQuery" placeholder="Live search...">35<p>{{ searchQuery.length }} characters</p>3637<!-- Character counter stays at 0 during IME input -->38</template>39```4041**Solution - Manual event binding for real-time updates:**42```html43<script setup>44import { ref } from 'vue'4546const searchQuery = ref('')4748// This captures EVERY input event, including during IME composition49function handleInput(event) {50searchQuery.value = event.target.value51}52</script>5354<template>55<!-- CORRECT: Manual binding captures all input, including IME composition -->56<input57:value="searchQuery"58@input="handleInput"59placeholder="Live search..."60>61<p>{{ searchQuery.length }} characters</p>62</template>63```6465```html66<!-- Shorter inline version -->67<input68:value="searchQuery"69@input="event => searchQuery = event.target.value"70>71```7273**When v-model behavior IS correct:**74```html75<!-- For form submission, waiting for composition IS usually better -->76<!-- User expects to confirm their character selection before it's "official" -->77<input v-model="formName" placeholder="Enter your name">7879<!-- The final composed characters will be submitted, not intermediate states -->80```8182## Reference83- [Vue.js Form Input Bindings](https://vuejs.org/guide/essentials/forms.html)84