mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 01:17:16 +00:00
docs: some small updates
This commit is contained in:
parent
007eceb97f
commit
95906473be
@ -314,16 +314,18 @@ Now you can register server-only components with the `.server` suffix and use th
|
|||||||
|
|
||||||
Server-only components use `<NuxtIsland>` under the hood, meaning that `lazy` prop and `#fallback` slot are both passed down to `<NuxtIsland>`.
|
Server-only components use `<NuxtIsland>` under the hood, meaning that `lazy` prop and `#fallback` slot are both passed down to `<NuxtIsland>`.
|
||||||
|
|
||||||
#### server components and context
|
#### Server Component Context
|
||||||
|
|
||||||
When rendering a server-only or island component, `<NuxtIsland>` makes a HTTP request to GET a `NuxtIslandResponse`.
|
When rendering a server-only or island component, `<NuxtIsland>` makes a fetch request which comes back with a `NuxtIslandResponse`. (This is an internal request if rendered on the server, or a request that you can see in the network tab if it's rendering on client-side navigation.)
|
||||||
|
|
||||||
This means:
|
This means:
|
||||||
- A new Vue app will be created server-side to create the `NuxtIslandResponse`.
|
|
||||||
- You can't access to the island app context from your SSR app and you can't access to your SSR app context from the island component. Both are different context.
|
|
||||||
- Plugins will be ran for the island Vue app except those marked with `env.islands: false` on an object plugin.
|
|
||||||
|
|
||||||
You can access to an island context within an island component through `nuxtApp.ssrContext.islandContext`.
|
- A new Vue app will be created server-side to create the `NuxtIslandResponse`.
|
||||||
|
- A new 'island context' will be created while rendering the component.
|
||||||
|
- You can't access the 'island context' from the rest of your app and you can't access the context of the rest of your app from the island component. In other words, the server component or island is _isolated_ from the rest of your app.
|
||||||
|
- Your plugins will run again when rendering the island, unless they have `env: { islands: false }` set (which you can do in an object-syntax plugin).
|
||||||
|
|
||||||
|
Within an island component, you can access its island context through `nuxtApp.ssrContext.islandContext`. Note that while island components are still marked as experimental, the format of this context may change.
|
||||||
|
|
||||||
::alert{type=info}
|
::alert{type=info}
|
||||||
Slots can be interactive and are wrapped within a `<div>` with `display: contents;`
|
Slots can be interactive and are wrapped within a `<div>` with `display: contents;`
|
||||||
|
Loading…
Reference in New Issue
Block a user