Consider a computed property of:
computed: {
menuItems (){
let menuItems = [
{icon:'dashboard', title:'Home', link:'/'},
{icon:'fa-code', title:'Code Portfolio', link:'/code'},
{icon:'fa-rss', title:'Blog', link:'/'},
{icon:'fa-info-circle', title:'About', link:'/'},
{icon:'fa-envelope', title:'Contact', link:'/'},
]
return menuItems
}}
Using vue-router, how do I pass this array to the child component?
I've tried declaring the prop in the component and binding it to router-link:
Component:
props: ['menuItems']
Parent:
<router-view :menuItems="menuItems"></router-view>
This isn't working. How do I correctly pass the prop, or is there a better way to do it entirely. Thanks!
:menu-items="menuItems"
depending on how your template is defined. If it is in DOM, it needs to be kebab-cased. Otherwise it's something else. - Bert