Nuxt Nation カンファレンスが開催されます。11月12〜13日にご参加ください。

<Teleport>

<Teleport> コンポーネントは、コンポーネントを DOM の別の場所にテレポートします。
<Teleport>to ターゲットは、CSS セレクター文字列または実際の DOM ノードを期待します。Nuxt は現在、#teleports へのテレポートの SSR サポートのみを提供しており、クライアントサイドでは <ClientOnly> ラッパーを使用して他のターゲットをサポートしています。

ボディテレポート

<template>
  <button @click="open = true">
    Open Modal
  </button>
  <Teleport to="#teleports">
    <div v-if="open" class="modal">
      <p>Hello from the modal!</p>
      <button @click="open = false">
        Close
      </button>
    </div>
  </Teleport>
</template>

クライアントサイドテレポート

<template>
  <ClientOnly>
    <Teleport to="#some-selector">
      <!-- content -->
    </Teleport>
  </ClientOnly>
</template>
ドキュメント > 例 > 高度 > テレポートで、ライブの例を読んで編集してください。