Skip to content

Commit d54aecb

Browse files
amedorare-fort
authored andcommitted
Update components.md (#763)
* Update components.md * Update date
1 parent 024478a commit d54aecb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/v2/guide/components.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: コンポーネント
3-
updated: 2017-12-03
3+
updated: 2018-03-09
44
type: guide
55
order: 11
66
---
@@ -292,13 +292,22 @@ Vue.component('child', {
292292
式に通常の属性をバインディングするのと同様に、 `v-bind` を使用して親のデータにプロパティを動的にバインディングすることもできます。親でデータが更新される度に、そのデータが子に流れ落ちます:
293293

294294
``` html
295-
<div>
295+
<div id="prop-example-2">
296296
<input v-model="parentMsg">
297297
<br>
298298
<child v-bind:my-message="parentMsg"></child>
299299
</div>
300300
```
301301

302+
``` js
303+
new Vue({
304+
el: '#prop-example-2',
305+
data: {
306+
parentMsg: 'Message from parent'
307+
}
308+
})
309+
```
310+
302311
`v-bind` のための省略記法を使用するとよりシンプルです:
303312

304313
``` html
@@ -322,7 +331,7 @@ new Vue({
322331
components: {
323332
child: {
324333
props: ['myMessage'],
325-
template: '<span>{{myMessage}}</span>'
334+
template: '<span>{{ myMessage }}</span>'
326335
}
327336
}
328337
})

0 commit comments

Comments
 (0)