Created
May 19, 2017 05:26
-
-
Save spin-glass/bbbfa95062eb9182213407017a1c5657 to your computer and use it in GitHub Desktop.
Vue.jsの親子関係
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id='list'> | |
<child v-for='item in items' :key='item.id' :child='item'></child> | |
</div> | |
<script> | |
Vue.component('child', { | |
props: ['child'], | |
template: '<li>{{ child.name }}</li>' | |
}) | |
app = new Vue({ | |
el: '#list', | |
data: { | |
items: [ | |
{ name: 'item1'}, | |
{ name: 'item2'}, | |
{ name: 'item3'}, | |
] | |
} | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment