Parcourir la source

fix(v-model): avoid clearing IME compose state on updates (#2304)

fix #2302
ᴜɴвʏтᴇ il y a 5 ans
Parent
commit
fbd198fbfe
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      packages/runtime-dom/src/directives/vModel.ts

+ 2 - 0
packages/runtime-dom/src/directives/vModel.ts

@@ -79,6 +79,8 @@ export const vModelText: ModelDirective<
   },
   beforeUpdate(el, { value, modifiers: { trim, number } }, vnode) {
     el._assign = getModelAssigner(vnode)
+    // avoid clearing unresolved text. #2302
+    if ((el as any).composing) return
     if (document.activeElement === el) {
       if (trim && el.value.trim() === value) {
         return