You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/v2/api/index.md
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -82,9 +82,9 @@ type: api
82
82
83
83
> In 2.2.0+, this hook also captures errors in component lifecycle hooks. Also, when this hook is `undefined`, captured errors will be logged with `console.error` instead of crashing the app.
84
84
85
-
> In 2.4.0+ this hook also captures errors thrown inside Vue custom event handlers.
85
+
> In 2.4.0+, this hook also captures errors thrown inside Vue custom event handlers.
86
86
87
-
> In 2.6.0+ this hook also captures errors thrown inside `v-on` DOM listeners. In addition, if any of the covered hooks or handlers returns a Promise chain (e.g. async functions), the error from that Promise chain will also be handled.
87
+
> In 2.6.0+, this hook also captures errors thrown inside `v-on` DOM listeners. In addition, if any of the covered hooks or handlers returns a Promise chain (e.g. async functions), the error from that Promise chain will also be handled.
88
88
89
89
> Error tracking services [Sentry](https://sentry.io/for/vue/) and [Bugsnag](https://docs.bugsnag.com/platforms/browsers/vue/) provide official integrations using this option.
Explicitly creates a reactive object. This is what Vue performs internally on objects returned from a component's `data()` function.
416
+
Make an object reactive. Internally, Vue uses this on the object returned by the `data` function.
417
417
418
-
The returned object can be used directly inside [render functions](../guide/render-function.html) and [computed properties](../guide/computed.html), and will trigger appropriate updates when mutated. It can be used as a minimal cross-component state store for simple scenarios.
418
+
The returned object can be used directly inside [render functions](../guide/render-function.html) and [computed properties](../guide/computed.html), and will trigger appropriate updates when mutated. It can also be used as a minimal, cross-component state store for simple scenarios:
419
419
420
420
```js
421
-
constobj=Vue.observable({ count:0 })
421
+
conststate=Vue.observable({ count:0 })
422
422
423
423
constDemo= {
424
424
render(h) {
425
425
returnh('button', {
426
-
on: { click: () => { obj.count++ }}
427
-
}, `count is: ${obj.count}`)
426
+
on: { click: () => { state.count++ }}
427
+
}, `count is: ${state.count}`)
428
428
}
429
429
}
430
430
```
431
431
432
+
<pclass="tip">In Vue 2.x, `Vue.observable` directly mutates the object passed to it, so that it is equivalent to the object returned, as [demonstrated here](../guide/instance.html#Data-and-Methods). In Vue 3.x, a reactive proxy will be returned instead, leaving the original object non-reactive if mutated directly. Therefore, for future compatibility, we recommend always working with the object returned by `Vue.observable`, rather than the object originally passed to it.</p>
433
+
432
434
-**See also:**[Reactivity in Depth](../guide/reactivity.html)
0 commit comments