Skip to content

Commit 1a0e295

Browse files
fix error about deep option of watch in instance-methods.md (#951)
* Update instance-methods.md * Update src/api/instance-methods.md Co-authored-by: Natalia Tepluhina <[email protected]> Co-authored-by: Natalia Tepluhina <[email protected]>
1 parent ac55a72 commit 1a0e295

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/api/instance-methods.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@
121121

122122
- **Option: deep**
123123

124-
To also detect nested value changes inside Objects, you need to pass in `deep: true` in the options argument. Note that you don't need to do so to listen for array mutations.
124+
To also detect nested value changes inside Objects, you need to pass in `deep: true` in the options argument. This option also can be used to watch array mutations.
125+
126+
> Note: when mutating (rather than replacing) an Object or an Array and watch with deep option, 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.
125127
126128
```js
127129
vm.$watch('someObject', callback, {

0 commit comments

Comments
 (0)