docs: clarify navigateTo is not for nitro routes (#28092)

This commit is contained in:
John Tanzer 2024-07-11 10:07:30 +02:00 committed by GitHub
parent 4ea89318df
commit 8f7815e96e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ links:
size: xs size: xs
--- ---
`useNuxtApp` is a built-in composable that provides a way to access shared runtime context of Nuxt, also known as the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context), which is available on both client and server side. It helps you access the Vue app instance, runtime hooks, runtime config variables and internal states, such as `ssrContext` and `payload`. `useNuxtApp` is a built-in composable that provides a way to access shared runtime context of Nuxt, also known as the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context), which is available on both client and server side (but not within Nitro routes). It helps you access the Vue app instance, runtime hooks, runtime config variables and internal states, such as `ssrContext` and `payload`.
```vue [app.vue] ```vue [app.vue]
<script setup lang="ts"> <script setup lang="ts">

View File

@ -9,13 +9,17 @@ links:
--- ---
::note ::note
`navigateTo` is available on both server side and client side. `navigateTo` is available on both client and server side (but not within Nitro routes).
:: ::
## Usage ## Usage
`navigateTo` is available on both server side and client side. It can be used within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context), or directly, to perform page navigation. `navigateTo` is available on both server side and client side. It can be used within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context), or directly, to perform page navigation.
::tip
To send a redirect from a server endpoint, use [`sendRedirect`](https://h3.unjs.io/utils/response#sendredirectevent-location-code) instead.
::
### Within a Vue Component ### Within a Vue Component
```vue ```vue