Browse Source

fix: watcher oldValue

Evan You 7 years ago
parent
commit
023f4ef7f4
1 changed files with 1 additions and 1 deletions
  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 newValue = runner()
     if (options.deep || newValue !== oldValue) {
-      oldValue = newValue
       try {
         cb.call(instance.$proxy, newValue, oldValue)
       } catch (e) {
         handleError(e, instance, ErrorTypes.WATCH_CALLBACK)
       }
+      oldValue = newValue
     }
   }