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

fix #2302
This commit is contained in:
ᴜɴвʏтᴇ 2020-10-08 10:34:53 +08:00 committed by GitHub
parent 4d1ebb5deb
commit fbd198fbfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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