Home

Issue: 2599

Routes with optional prefix

[issue link]

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

This question is available on Nuxt.js community (#c2261)