File tree 2 files changed +48
-1
lines changed
2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,8 @@ const sidebar = {
128
128
'migration/render-function-api' ,
129
129
'migration/slots-unification' ,
130
130
'migration/transition' ,
131
- 'migration/v-model'
131
+ 'migration/v-model' ,
132
+ 'migration/v-bind'
132
133
]
133
134
} ,
134
135
{
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : v-bind マージの振る舞い
3
+ badges :
4
+ - breaking
5
+ ---
6
+
7
+ # {{ $frontmatter.title }} <MigrationBadges :badges =" $frontmatter.badges " />
8
+
9
+ ## 概要
10
+
11
+ - ** 破壊的変更** : v-bind のバインディングの並び順が、レンダリングの結果に影響します。
12
+
13
+ ## イントロダクション
14
+
15
+ 要素に属性を動的にバインドする場合、一般的なシナリオでは、` v-bind="object" ` 構文と、同じ要素内にある個別のプロパティの両方を使用します。しかし、これだとマージの優先順位について疑問が残ります。
16
+
17
+ ## 2.x での構文
18
+
19
+ Vue 2.x では、要素に ` v-bind="object" ` 構文と同一の個別のプロパティの両方が定義されている場合、個別のプロパティは常に ` object ` 内のバインディングを上書きします。
20
+
21
+ ``` html
22
+ <!-- テンプレート -->
23
+ <div id =" red" v-bind =" { id: 'blue' }" ></div >
24
+ <!-- 結果 -->
25
+ <div id =" red" ></div >
26
+ ```
27
+
28
+ ## 3.x での構文
29
+
30
+ Vue 3.x では、要素に ` v-bind="object" ` 構文と同一の個別のプロパティの両方が定義されている場合、バインディングの宣言されている順番がそれらをどのようにマージするかを決定します。言い換えると、開発者は個別のプロパティが ` object ` で定義されているものを常に上書きするのだと決め込むのではなく、希望するマージの振る舞いをコントロールできるようになります。
31
+
32
+ ``` html
33
+ <!-- テンプレート -->
34
+ <div id =" red" v-bind =" { id: 'blue' }" ></div >
35
+ <!-- 結果 -->
36
+ <div id =" blue" ></div >
37
+
38
+ <!-- テンプレート -->
39
+ <div v-bind =" { id: 'blue' }" id =" red" ></div >
40
+ <!-- 結果 -->
41
+ <div id =" red" ></div >
42
+ ```
43
+
44
+ ## 移行の戦略
45
+
46
+ もしこの上書きの機能を ` v-bind ` のために利用しているとしたら、` v-bind ` 属性が個別のプロパティより前に定義されているか確認することを推奨します。
You can’t perform that action at this time.
0 commit comments