Skip to content

Commit 065b8b3

Browse files
committed
tweak wathcer
1 parent dae1f3d commit 065b8b3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/core/observer/watcher.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,19 @@ export default class Watcher {
4040
vm: Component,
4141
expOrFn: string | Function,
4242
cb: Function,
43-
options?: Object = {}
43+
options?: Object
4444
) {
4545
this.vm = vm
4646
vm._watchers.push(this)
4747
// options
48-
this.deep = !!options.deep
49-
this.user = !!options.user
50-
this.lazy = !!options.lazy
51-
this.sync = !!options.sync
48+
if (options) {
49+
this.deep = !!options.deep
50+
this.user = !!options.user
51+
this.lazy = !!options.lazy
52+
this.sync = !!options.sync
53+
} else {
54+
this.deep = this.user = this.lazy = this.sync = false
55+
}
5256
this.cb = cb
5357
this.id = ++uid // uid for batching
5458
this.active = true

0 commit comments

Comments
 (0)