Skip to content

Commit 0df12c5

Browse files
wangyi7099Jinjiang
authored andcommitted
Add watch usages (#1356)
* Add watch usages! Add `watch` usages! * Update index.md * tweaks to watch api examples
1 parent d1cb0d1 commit 0df12c5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/v2/api/index.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ type: api
587587

588588
### watch
589589

590-
- **类型**`{ [key: string]: string | Function | Object }`
590+
- **类型**`{ [key: string]: string | Function | Object | Array }`
591591

592592
- **详细**
593593

@@ -601,7 +601,12 @@ type: api
601601
a: 1,
602602
b: 2,
603603
c: 3,
604-
d: 4
604+
d: 4,
605+
e: {
606+
f: {
607+
g: 5
608+
}
609+
}
605610
},
606611
watch: {
607612
a: function (val, oldVal) {
@@ -618,7 +623,13 @@ type: api
618623
d: {
619624
handler: function (val, oldVal) { /* ... */ },
620625
immediate: true
621-
}
626+
},
627+
e: [
628+
function handle1 (val, oldVal) { /* ... */ },
629+
function handle2 (val, oldVal) { /* ... */ }
630+
],
631+
// watch vm.e.f's value: {g: 5}
632+
'e.f': function (val, oldVal) { /* ... */ }
622633
}
623634
})
624635
vm.a = 2 // => new: 2, old: 1

0 commit comments

Comments
 (0)