Nuxt/docs/content/3.docs/2.directory-structure/9.pages.md
Sébastien Chopin 18cf0ba865
chore(docs): improvements (#655)
Co-authored-by: Sylvain Marroufin <marroufin.sylvain@gmail.com>
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
2021-10-11 14:57:54 +02:00

972 B

icon title head.title
IconDirectory pages Pages directory

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.

Example

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

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

<template>
  {{ $route.params.group }}
  {{ $route.params.id }}
</template>