Răsfoiți Sursa

fix: watcher oldValue

Evan You 7 ani în urmă
părinte
comite
023f4ef7f4
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      packages/core/src/componentWatch.ts

+ 1 - 1
packages/core/src/componentWatch.ts

@@ -61,12 +61,12 @@ export function setupWatcher(
   const applyCb = () => {
   const applyCb = () => {
     const newValue = runner()
     const newValue = runner()
     if (options.deep || newValue !== oldValue) {
     if (options.deep || newValue !== oldValue) {
-      oldValue = newValue
       try {
       try {
         cb.call(instance.$proxy, newValue, oldValue)
         cb.call(instance.$proxy, newValue, oldValue)
       } catch (e) {
       } catch (e) {
         handleError(e, instance, ErrorTypes.WATCH_CALLBACK)
         handleError(e, instance, ErrorTypes.WATCH_CALLBACK)
       }
       }
+      oldValue = newValue
     }
     }
   }
   }