Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

docs(navigate-to): use await instead of return #7734

Merged
merged 2 commits into from Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/content/3.api/3.utils/navigate-to.md
Expand Up @@ -71,13 +71,13 @@ An object accepting the following properties:
```vue
<script setup>
// passing 'to' as a string
return navigateTo('/search')
await navigateTo('/search')

// ... or as a route object
return navigateTo({ path: '/search' })
await navigateTo({ path: '/search' })

// ... or as a route object with query parameters
return navigateTo({
await navigateTo({
path: '/search',
query: {
page: 1,
Expand All @@ -103,13 +103,13 @@ export default defineNuxtRouteMiddleware((to, from) => {

```vue
<script setup>
// will throw an error;
// navigating to an external URL is not allowed by default
await navigateTo('https://v3.nuxtjs.org')

// will redirect successfully with the 'external' parameter set to 'true'
await navigateTo('https://v3.nuxtjs.org', {
external: true
})
// will throw an error;
// navigating to an external URL is not allowed by default
await navigateTo('https://v3.nuxtjs.org')

// will redirect successfully with the 'external' parameter set to 'true'
await navigateTo('https://v3.nuxtjs.org', {
external: true
})
</script>
```