1
I have a prop in the goal of some routes called "displayname", I wanted to play all routes that had this prop in a navbar.. I have tried but unsuccessfully, so far I can pull all routes to the Nav component, and using the v-for I assemble the links in the navbar, but that way all my routes appear, and I just want some specifics... follow an example route with this prop and what I’ve done so far:
Route:
export const routes = [
{ path: '/', component: Home, name: 'Home',
meta: {
displayName: 'Home'
}
}
];
Function that picks up the routes in the Nav component:
computed: {
routes(){
return this.$router.options.routes
}
},
And v-for creates the links inside the Nav:
<router-link v-for="(r, index) in routes" :key="index" class="links" :to="r">{{ r.name }}</router-link>
The idea is to only have route links with prop displayname, and use the value of this prop in the link display.
Thank you for your attention.
it worked mt well, thanks.
– João