mirror of https://github.com/vuejs/core.git
fix(v-model): fix the lazy modifier is not reset by other modifications (#8547)
close #8546 close #6564 close #6773
This commit is contained in:
parent
34a97edd2c
commit
a52a02f43f
|
@ -82,7 +82,11 @@ export const vModelText: ModelDirective<
|
|||
mounted(el, { value }) {
|
||||
el.value = value == null ? '' : value
|
||||
},
|
||||
beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
||||
beforeUpdate(
|
||||
el,
|
||||
{ value, oldValue, modifiers: { lazy, trim, number } },
|
||||
vnode
|
||||
) {
|
||||
el[assignKey] = getModelAssigner(vnode)
|
||||
// avoid clearing unresolved text. #2302
|
||||
if ((el as any).composing) return
|
||||
|
@ -97,7 +101,8 @@ export const vModelText: ModelDirective<
|
|||
}
|
||||
|
||||
if (document.activeElement === el && el.type !== 'range') {
|
||||
if (lazy) {
|
||||
// #8546
|
||||
if (lazy && value === oldValue) {
|
||||
return
|
||||
}
|
||||
if (trim && el.value.trim() === newValue) {
|
||||
|
|
Loading…
Reference in New Issue