The pages/ directory is optional, meaning that if you only use app.vue , vue-router won't be included, reducing your application bundle size.

Pages directory

Nuxt will automatically integrate Vue Router and map pages/ directory into the routes of your application.

Dynamic Routes

If you place anything within square brackets, it will be turned into a dynamic route parameter. You can mix and match multiple parameters and even non-dynamic text within a file name or directory.

If you need a catch-all route, you create it by using a file named like [...slug].vue. This will match all routes under that path, and thus it doesn't support any non-dynamic text.


-| pages/
---| index.vue
---| users-[group]/
-----| [id].vue

Given the example above, you can access group/id within your component via the $route object:

  {{ $ }}
  {{ $ }}
Edit this page on GitHub Updated at Fri, Oct 15, 2021