mirror of https://github.com/vuejs/core.git
fix(runtime-vapor): only update oldValue in beforeUpdate hook
This commit is contained in:
parent
94272c6163
commit
f4f467811a
|
@ -90,7 +90,7 @@ export function withDirectives<T extends Node>(
|
||||||
instance,
|
instance,
|
||||||
source,
|
source,
|
||||||
value: null, // set later
|
value: null, // set later
|
||||||
oldValue: null,
|
oldValue: undefined,
|
||||||
arg,
|
arg,
|
||||||
modifiers,
|
modifiers,
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ function callDirectiveHook(
|
||||||
const hook = dir[name]
|
const hook = dir[name]
|
||||||
if (!hook) return
|
if (!hook) return
|
||||||
|
|
||||||
|
if (name === 'beforeUpdate') binding.oldValue = binding.value
|
||||||
const newValue = binding.source ? binding.source() : undefined
|
const newValue = binding.source ? binding.source() : undefined
|
||||||
binding.value = newValue
|
binding.value = newValue
|
||||||
// disable tracking inside all lifecycle hooks
|
// disable tracking inside all lifecycle hooks
|
||||||
|
@ -143,7 +144,6 @@ function callDirectiveHook(
|
||||||
binding,
|
binding,
|
||||||
])
|
])
|
||||||
resetTracking()
|
resetTracking()
|
||||||
if (name !== 'beforeUpdate') binding.oldValue = binding.value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveDirective() {
|
export function resolveDirective() {
|
||||||
|
|
Loading…
Reference in New Issue