瀏覽代碼

fix: watcher oldValue

Evan You 7 年之前
父節點
當前提交
023f4ef7f4
共有 1 個文件被更改,包括 1 次插入1 次删除
  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
     }
   }