I create router-links with a v-for where I pass params props so I can access them in my router-view. Now I need to have my route props available when a route is accessed other ways than clicking the link, like navigating with $router.go or external URL. How can I pull/sync this data from the existing router-links?
<router-link
v-for="item in items"
:to="{
name: 'Item',
params: {
url: `${item.no}-${item.title.replace(/\s+/g, '-')}`,
no: item.no,
title: item.title
}
}">
{{item.no}}
{{item.title}}
</router-link>
Inside the Item component:
<article :key="no">
<h1> {{ no }} {{ title }} </h1>
</article>
The route:
export default new Router({
routes: [
{
path: '/:url',
name: 'Item',
component: Item,
props: true
}
]
})