I want to achieve the following behavior in my Vue project:
routes: [
{
path: '/:prefix?',
component: Layout,
children: [
{path: 'category/:slug?', name: 'category', component: Category},
{path: 'post/:slug', name: 'post', component: Post},
{path: '', name: 'home', component: Home}, // <-- MUST BE AT THE BOTTOM
// etc..
]
}
]
As you see, every route can have an optional prefix. The prefix
parameter should also accept an empty string. Is this kind of thing achievable?
Thanks
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2261">#c2261</a>)</em></sub></div>