表題の通り、Vuejsの親→子Componentへのprop渡しをオブジェクトで渡す方法を知りたいです。
多くのサンプルは"parantMsg"などの簡易的なメッセージしかなく困っております。
また公式マニュアルを見ても十分理解できなかったため、何卒ご教示頂ければ幸いです。
※parentObjを1.child.vueへ渡す方法と2.child.vueで受け取る方法が知りたいです。(今回は仮にfather_idとmother_idがあると仮定します)
parant.vue
<template> <div class="parent"> <parent v-for="parent in parentObj" :fatherId="parent.father_id"></parent> </div> </template> <script> import child from './child.vue'; export default { name: 'children', components: { child }, data: function() { return { parentObj : [], } }, created: function() { axios.get('/api/parent/') . . . } } </script>
child.vue
<template> <div class="child"> {{fatherId}} </div> </template> <script> export default { props: ['userId'] } </script>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/29 09:12