diff --git a/docs/3.api/1.components/2.nuxt-page.md b/docs/3.api/1.components/2.nuxt-page.md index c8930e350c..6628fed523 100644 --- a/docs/3.api/1.components/2.nuxt-page.md +++ b/docs/3.api/1.components/2.nuxt-page.md @@ -11,26 +11,45 @@ links: `` is a built-in component that comes with Nuxt. It lets you display top-level or nested pages located in the [`pages/`](/docs/guide/directory-structure/pages) directory. ::note -`` is a wrapper around [``](https://router.vuejs.org/api/interfaces/RouterViewProps.html#interface-routerviewprops) component from Vue Router. :br -It accepts same `name` and `route` props. +`` is a wrapper around [``](https://router.vuejs.org/api/interfaces/RouterViewProps.html#interface-routerviewprops) from Vue Router. It should be used instead of `` because the former takes additional care of internal states. Otherwise, `useRoute()` may return incorrect paths. :: +`` includes the following components: + +```vue + +``` + +By default, Nuxt does not enable `` and ``. You can enable them in the nuxt.config file or by setting the `transition` and `keepalive` properties on ``. If you want to define a specific page, you can set it in `definePageMeta` in the page component. + ::warning -`` should be used instead of `` as the former takes additional care on internal states. Otherwise, `useRoute()` may return incorrect paths. +If you enable `` in your page component, ensure that the page has a single root element. :: ## Props -- `name`: tells `RouterView` to render the component with the corresponding name in the matched route record's components option. +- `name`: tells `` to render the component with the corresponding name in the matched route record's components option. - type: `string` - `route`: route location that has all of its components resolved. - type: `RouteLocationNormalized` - `pageKey`: control when the `NuxtPage` component is re-rendered. - type: `string` or `function` - `transition`: define global transitions for all pages rendered with the `NuxtPage` component. - - type: `boolean` or `TransitionProps` + - type: `boolean` or [`TransitionProps`](https://vuejs.org/api/built-in-components#transition) - `keepalive`: control state preservation of pages rendered with the `NuxtPage` component. - - type: `boolean` or `KeepAliveProps` + - type: `boolean` or [`KeepAliveProps`](https://vuejs.org/api/built-in-components#keepalive) ::tip Nuxt automatically resolves the `name` and `route` by scanning and rendering all Vue component files found in the `/pages` directory. @@ -38,7 +57,7 @@ Nuxt automatically resolves the `name` and `route` by scanning and rendering all ## Example -For example, passing `static` key, `NuxtPage` component is rendered only once when it is mounted. +For example, if you pass a key that never changes, the `` component will be rendered only once - when it is first mounted. ```vue [app.vue]