fix(v-model): should not trigger updates during input composition (#1183)

This commit is contained in:
underfin 2020-05-18 22:23:55 +08:00 committed by GitHub
parent 520cad7d4d
commit 83b7158017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,8 @@ export const vModelText: ModelDirective<
el.value = value el.value = value
el._assign = getModelAssigner(vnode) el._assign = getModelAssigner(vnode)
const castToNumber = number || el.type === 'number' const castToNumber = number || el.type === 'number'
addEventListener(el, lazy ? 'change' : 'input', () => { addEventListener(el, lazy ? 'change' : 'input', e => {
if ((e.target as any).composing) return
let domValue: string | number = el.value let domValue: string | number = el.value
if (trim) { if (trim) {
domValue = domValue.trim() domValue = domValue.trim()