Skip to content

Commit 2106042

Browse files
Added watching a nested property to API reference (#935)
* fix: added watching a nested property * Update src/api/options-data.md Co-authored-by: skirtle <[email protected]> Co-authored-by: skirtle <[email protected]>
1 parent 8188362 commit 2106042

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/api/options-data.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,12 @@
190190
c: {
191191
d: 4
192192
},
193-
e: 'test',
194-
f: 5
193+
e: 5,
194+
f: 6
195195
}
196196
},
197197
watch: {
198+
// watching top-level property
198199
a(val, oldVal) {
199200
console.log(`new: ${val}, old: ${oldVal}`)
200201
},
@@ -207,6 +208,10 @@
207208
},
208209
deep: true
209210
},
211+
// watching a single nested property:
212+
'c.d': function (val, oldVal) {
213+
// do something
214+
},
210215
// the callback will be called immediately after the start of the observation
211216
e: {
212217
handler(val, oldVal) {

0 commit comments

Comments
 (0)