0๐
I think you are looking for this:
computed: {
routeList() {
return this.$router.options.routes
}
}
0๐
Got it, I added all Layout Stuff into my App.vue and uses the routes like normal, why so complicated ๐
const routes = [
{ path: '/', name: 'home', component: () => import('pages/Index.vue') },
{ path: '/users', name: 'users', component: () => import('pages/Users.vue') },
{ path: '/news', name: 'news', component: () => import('pages/News.vue') },
{ path: '*', component: () => import('pages/Error404.vue') },
];
export default routes;
and as nav links:
<router-link
v-for="route in $router.options.routes"
:key="route.path"
:to="route.path"
>{{ route.name }}</router-link
>
works as aspected.
Source:stackexchange.com