docs: recommend '#teleports' target instead of 'body' (#28489)

This commit is contained in:
Matej Černý 2024-08-09 18:55:10 +02:00 committed by GitHub
parent 4eef63469b
commit 48377fa18c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ description: The <Teleport> component teleports a component to a different locat
---
::warning
The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport.html) expects a CSS selector string or an actual DOM node. Nuxt currently has SSR support for teleports to `body` only, with client-side support for other targets using a `<ClientOnly>` wrapper.
The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport.html) expects a CSS selector string or an actual DOM node. Nuxt currently has SSR support for teleports to `#teleports` only, with client-side support for other targets using a `<ClientOnly>` wrapper.
::
## Body Teleport
@ -14,7 +14,7 @@ The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport.htm
<button @click="open = true">
Open Modal
</button>
<Teleport to="body">
<Teleport to="#teleports">
<div v-if="open" class="modal">
<p>Hello from the modal!</p>
<button @click="open = false">