Procházet zdrojové kódy

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

三咲智子 Kevin Deng před 2 roky
rodič
revize
75c8ff5cb7
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      packages/runtime-vapor/src/directive.ts

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

@@ -129,11 +129,11 @@ function callDirectiveHook(
   instance: ComponentInternalInstance | null,
   name: DirectiveHookName,
 ) {
+  if (name === 'beforeUpdate') binding.oldValue = binding.value
   const { dir } = binding
   const hook = dir[name]
   if (!hook) return
 
-  if (name === 'beforeUpdate') binding.oldValue = binding.value
   const newValue = binding.source ? binding.source() : undefined
   binding.value = newValue
   // disable tracking inside all lifecycle hooks