mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 00:52:01 +00:00
docs: warn about single root element for server components (#26462)
This commit is contained in:
parent
8911c0d0dd
commit
09e53fc6d9
@ -299,6 +299,10 @@ Now you can register server-only components with the `.server` suffix and use th
|
|||||||
|
|
||||||
Server-only components use [`<NuxtIsland>`](/docs/api/components/nuxt-island) under the hood, meaning that `lazy` prop and `#fallback` slot are both passed down to it.
|
Server-only components use [`<NuxtIsland>`](/docs/api/components/nuxt-island) under the hood, meaning that `lazy` prop and `#fallback` slot are both passed down to it.
|
||||||
|
|
||||||
|
::alert{type=warning}
|
||||||
|
Server components (and islands) must have a single root element. (HTML comments are considered elements as well.)
|
||||||
|
::
|
||||||
|
|
||||||
::alert{type=warning}
|
::alert{type=warning}
|
||||||
Most features for server-only components and island components, such as slots and client components, are only available for single file components.
|
Most features for server-only components and island components, such as slots and client components, are only available for single file components.
|
||||||
::
|
::
|
||||||
|
@ -57,7 +57,7 @@ If you are using [`app.vue`](/docs/guide/directory-structure/app), make sure to
|
|||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
|
||||||
Pages **must have a single root element** to allow [route transitions](/docs/getting-started/transitions) between pages, HTML comments are considered elements as well.
|
Pages **must have a single root element** to allow [route transitions](/docs/getting-started/transitions) between pages. HTML comments are considered elements as well.
|
||||||
|
|
||||||
This means that when the route is server-rendered, or statically generated, you will be able to see its contents correctly, but when you navigate towards that route during client-side navigation the transition between routes will fail and you'll see that the route will not be rendered.
|
This means that when the route is server-rendered, or statically generated, you will be able to see its contents correctly, but when you navigate towards that route during client-side navigation the transition between routes will fail and you'll see that the route will not be rendered.
|
||||||
|
|
||||||
@ -365,6 +365,10 @@ You can define a page as [client only](/docs/guide/directory-structure/component
|
|||||||
|
|
||||||
You can define a page as [server only](/docs/guide/directory-structure/components#server-components) by giving it a `.server.vue` suffix. While you will be able to navigate to the page using client-side navigation, controlled by `vue-router`, it will be rendered with a server component automatically, meaning the code required to render the page will not be in your client-side bundle.
|
You can define a page as [server only](/docs/guide/directory-structure/components#server-components) by giving it a `.server.vue` suffix. While you will be able to navigate to the page using client-side navigation, controlled by `vue-router`, it will be rendered with a server component automatically, meaning the code required to render the page will not be in your client-side bundle.
|
||||||
|
|
||||||
|
::alert{type=warning}
|
||||||
|
Server-only pages must have a single root element. (HTML comments are considered elements as well.)
|
||||||
|
::
|
||||||
|
|
||||||
## Custom Routing
|
## Custom Routing
|
||||||
|
|
||||||
As your app gets bigger and more complex, your routing might require more flexibility. For this reason, Nuxt directly exposes the router, routes and router options for customization in different ways.
|
As your app gets bigger and more complex, your routing might require more flexibility. For this reason, Nuxt directly exposes the router, routes and router options for customization in different ways.
|
||||||
|
Loading…
Reference in New Issue
Block a user