Skip to content

Commit b170627

Browse files
committed
Added watching a nested property to API reference
vuejs/docs@2106042
1 parent 39654f0 commit b170627

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)