nuxt-community / router-extras-module

Extra Add-ons For Nuxt 2 Router
https://codesandbox.io/s/github/nuxt-community/router-extras-module
MIT License
279 stars 12 forks source link

I'd like to ignore the auto-generated route of the page I am using the router extras in #154

Open CodyBontecou opened 3 years ago

CodyBontecou commented 3 years ago

Say I have a page example.vue with the following <router> property:

<router>
  alias:
  - path: '/event/:id'
  - path: '/:username/:eventName/:eventCount'
</router>

My generated router.js looks like:

{
    path: '/example',
    component: _4e18dbd1,
    name: 'example',
},
{
    path: '/event/:id',
    component: _4e18dbd1,
    name: 'example/event/:id',
},
{
    path: '/:username/:eventName/:eventCount',
    component: _4e18dbd1,
    name: 'example/:username/:eventName/:eventCount',
},

Is it possible to remove the /example route altogether? Or is the expected solution to this to create an example/event/_id.vue file with the router logic placed in there?

farnabaz commented 3 years ago

Hey, Sorry for the late response You can use path option instead of alias to change the route itself

<router>
  path: '/event/:id'
  alias:
  - path: '/:username/:eventName/:eventCount'
</router>