Evan You 11 лет назад
Родитель
Сommit
ae2432e25b
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/watcher.js

+ 3 - 1
src/watcher.js

@@ -18,6 +18,7 @@ var uid = 0
  *                 - {Boolean} twoWay
  *                 - {Boolean} deep
  *                 - {Boolean} user
+ *                 - {Boolean} sync
  *                 - {Function} [preProcess]
  * @constructor
  */
@@ -34,6 +35,7 @@ function Watcher (vm, expOrFn, cb, options) {
   this.deep = !!options.deep
   this.user = !!options.user
   this.twoWay = !!options.twoWay
+  this.sync = !!options.sync
   this.filters = options.filters
   this.preProcess = options.preProcess
   this.deps = []
@@ -160,7 +162,7 @@ p.afterGet = function () {
  */
 
 p.update = function () {
-  if (!config.async) {
+  if (this.sync || !config.async) {
     this.run()
   } else {
     batcher.push(this)