2
0
Эх сурвалжийг харах

fix(runtime-vapor): update old value even if no beforeUpdate hook

三咲智子 Kevin Deng 2 жил өмнө
parent
commit
75c8ff5cb7

+ 1 - 1
packages/runtime-vapor/src/directive.ts

@@ -129,11 +129,11 @@ function callDirectiveHook(
   instance: ComponentInternalInstance | null,
   instance: ComponentInternalInstance | null,
   name: DirectiveHookName,
   name: DirectiveHookName,
 ) {
 ) {
+  if (name === 'beforeUpdate') binding.oldValue = binding.value
   const { dir } = binding
   const { dir } = binding
   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