Skip to content

Commit 25aa51b

Browse files
Merge branch 'master' of github.com:vuejs/docs-next
2 parents c8f4182 + dd5ab86 commit 25aa51b

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

src/api/global-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Creates an async component that will be loaded only when it's necessary.
136136

137137
### Arguments
138138

139-
For basic usage, `defineAsyncComponent` can accept a a factory function returning a `Promise`. Promise's `resolve` callback should be called when you have retrieved your component definition from the server. You can also call `reject(reason)` to indicate the load has failed.
139+
For basic usage, `defineAsyncComponent` can accept a factory function returning a `Promise`. Promise's `resolve` callback should be called when you have retrieved your component definition from the server. You can also call `reject(reason)` to indicate the load has failed.
140140

141141
```js
142142
import { defineAsyncComponent } from 'vue'

src/api/instance-methods.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
- **Usage:**
1616

17-
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 dot-delimited paths. For more complex expressions, use a function instead.
17+
Watch a reactive property or a computed function on the Vue instance for changes. The callback gets called with the new value and the old value for the given property. We can only pass top-level `data`, `prop`, or `computed` property name as a string. For more complex expressions or nested properties, use a function instead.
1818

1919
- **Example:**
2020

@@ -23,16 +23,28 @@
2323
data() {
2424
return {
2525
a: 1,
26-
b: 2
26+
b: 2,
27+
c: {
28+
d: 3,
29+
e: 4
30+
}
2731
}
2832
},
2933
created() {
30-
// keypath
34+
// top-level property name
3135
this.$watch('a', (newVal, oldVal) => {
3236
// do something
3337
})
3438

35-
// function
39+
// function for watching a single nested property
40+
this.$watch(
41+
() => this.c.d,
42+
(newVal, oldVal) => {
43+
// do something
44+
}
45+
)
46+
47+
// function for watching a complex expression
3648
this.$watch(
3749
// every time the expression `this.a + this.b` yields a different result,
3850
// the handler will be called. It's as if we were watching a computed

src/guide/computed.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ You may have noticed we can achieve the same result by invoking a method in the
9393
```js
9494
// in component
9595
methods: {
96-
calculateBooksMessage()() {
96+
calculateBooksMessage() {
9797
return this.author.books.length > 0 ? 'Yes' : 'No'
9898
}
9999
}

src/guide/migration/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The following consists a list of breaking changes from 2.x:
3838
- Some transition classes got a rename:
3939
- `v-enter` -> `v-enter-from`
4040
- `v-leave` -> `v-leave-from`
41+
- [Component watch option](/api/options-data.html#watch) and [instance method `$watch`](/api/instance-methods.html#watch) no longer supports dot-delimited string paths, use a computed function as the parameter instead
4142

4243
### Removed
4344

0 commit comments

Comments
 (0)