docs: clarify lifecycle behavior of <NuxtPage> during page changes (#31116)

This commit is contained in:
Alex Liu 2025-03-05 00:16:08 +08:00 committed by Daniel Roe
parent a243f8fcf6
commit 67e69f9871
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -38,6 +38,10 @@ By default, Nuxt does not enable `<Transition>` and `<KeepAlive>`. You can enabl
If you enable `<Transition>` in your page component, ensure that the page has a single root element.
::
Since `<NuxtPage>` uses `<Suspense>` under the hood, the component lifecycle behavior during page changes differs from that of a typical Vue application.
In a typical Vue application, a new page component is mounted **only after** the previous one has been fully unmounted. However, in Nuxt, due to how Vue `<Suspense>` is implemented, the new page component is mounted **before** the previous one is unmounted.
## Props
- `name`: tells `<RouterView>` to render the component with the corresponding name in the matched route record's components option.