Skip to content

update vm.$watch api info (fix #569) #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/v2/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc

- **Usage:**

Watch an expression or a computed function on the Vue instance for changes. The callback gets called with the new value and the old value. The expression can be a single keypath or any valid binding expressions.
Watch an expression or a computed function on the Vue instance for changes. The callback gets called with the new value and the old value. The expression only accepts simple dot-delimited paths. For more complex expression, use a function instead.

<p class="tip">Note: when mutating (rather than replacing) an Object or an Array, the old value will be the same as new value because they reference the same Object/Array. Vue doesn't keep a copy of the pre-mutate value.</p>

Expand All @@ -1029,11 +1029,6 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
// do something
})

// expression
vm.$watch('a + b', function (newVal, oldVal) {
// do something
})

// function
vm.$watch(
function () {
Expand Down