Skip to content

Instantly share code, notes, and snippets.

@spin-glass
Created May 19, 2017 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spin-glass/bbbfa95062eb9182213407017a1c5657 to your computer and use it in GitHub Desktop.
Save spin-glass/bbbfa95062eb9182213407017a1c5657 to your computer and use it in GitHub Desktop.
Vue.jsの親子関係
<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