File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,8 @@ const sidebar = {
136
136
'migration/transition' ,
137
137
'migration/v-if-v-for' ,
138
138
'migration/v-model' ,
139
- 'migration/v-bind'
139
+ 'migration/v-bind' ,
140
+ 'migration/watch'
140
141
]
141
142
} ,
142
143
{
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : 配列の監視
3
+ badges :
4
+ - breaking
5
+ ---
6
+
7
+ # {{ $frontmatter.title }} <MigrationBadges :badges =" $frontmatter.badges " />
8
+
9
+ ## 概要
10
+
11
+ - ** 破壊的変更** : 配列を監視している場合、コールバックは配列が置き換えられたときにのみ実行します。配列の変更で実行する必要がある場合は、 ` deep ` オプションを指定する必要があります。
12
+
13
+ ## 3.x の構文
14
+
15
+ [ ` watch ` オプション] ( /api/options-data.html#watch ) を使って配列を監視する場合、コールバックは配列が置き換えられたときにのみ実行します。言い換えれば、 watch コールバックは配列の変更では実行されなくなります。配列の変更で実行するには、 ` deep ` オプションを指定する必要があります。
16
+
17
+ ``` js
18
+ watch: {
19
+ bookList: {
20
+ handler (val , oldVal ) {
21
+ console .log (' book list changed' )
22
+ },
23
+ deep: true
24
+ },
25
+ }
26
+ ```
27
+
28
+ ## 移行の戦略
29
+
30
+ 配列の変更を監視することに依存している場合は、 ` deep ` プロパティを追加して、コールバックが正しく実行されるようにします。
You can’t perform that action at this time.
0 commit comments