@nuxt/docs-nightly 4.1.3-29314777.50febbbb → 4.1.3-29316215.910d159d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/1.getting-started/03.configuration.md +19 -19
  2. package/1.getting-started/04.views.md +1 -1
  3. package/1.getting-started/05.assets.md +8 -2
  4. package/1.getting-started/06.styling.md +50 -40
  5. package/1.getting-started/07.routing.md +4 -4
  6. package/1.getting-started/08.seo-meta.md +46 -33
  7. package/1.getting-started/09.transitions.md +38 -33
  8. package/1.getting-started/10.data-fetching.md +47 -39
  9. package/1.getting-started/11.state-management.md +15 -8
  10. package/1.getting-started/12.error-handling.md +6 -4
  11. package/1.getting-started/13.server.md +3 -3
  12. package/1.getting-started/14.layers.md +18 -12
  13. package/1.getting-started/15.prerendering.md +24 -24
  14. package/1.getting-started/16.deployment.md +7 -7
  15. package/1.getting-started/17.testing.md +41 -41
  16. package/1.getting-started/18.upgrade.md +48 -66
  17. package/2.guide/1.directory-structure/1.app/1.components.md +36 -19
  18. package/2.guide/1.directory-structure/1.app/1.composables.md +7 -7
  19. package/2.guide/1.directory-structure/1.app/1.layouts.md +9 -5
  20. package/2.guide/1.directory-structure/1.app/1.middleware.md +20 -14
  21. package/2.guide/1.directory-structure/1.app/1.pages.md +19 -17
  22. package/2.guide/1.directory-structure/1.app/1.plugins.md +17 -17
  23. package/2.guide/1.directory-structure/1.app/1.utils.md +1 -1
  24. package/2.guide/1.directory-structure/1.app/3.app-config.md +6 -6
  25. package/2.guide/1.directory-structure/1.app/3.error.md +4 -4
  26. package/2.guide/1.directory-structure/1.content.md +4 -1
  27. package/2.guide/1.directory-structure/1.modules.md +4 -4
  28. package/2.guide/1.directory-structure/1.public.md +1 -1
  29. package/2.guide/1.directory-structure/1.server.md +28 -28
  30. package/2.guide/1.directory-structure/1.shared.md +1 -1
  31. package/2.guide/2.concepts/1.auto-imports.md +11 -11
  32. package/2.guide/2.concepts/2.vuejs-development.md +5 -5
  33. package/2.guide/2.concepts/3.rendering.md +14 -12
  34. package/2.guide/2.concepts/5.modules.md +2 -2
  35. package/2.guide/2.concepts/7.esm.md +14 -12
  36. package/2.guide/2.concepts/8.typescript.md +4 -4
  37. package/2.guide/3.going-further/1.events.md +2 -2
  38. package/2.guide/3.going-further/1.experimental-features.md +234 -73
  39. package/2.guide/3.going-further/1.features.md +44 -9
  40. package/2.guide/3.going-further/1.internals.md +15 -15
  41. package/2.guide/3.going-further/10.runtime-config.md +7 -7
  42. package/2.guide/3.going-further/2.hooks.md +8 -8
  43. package/2.guide/3.going-further/3.modules.md +76 -74
  44. package/2.guide/3.going-further/4.kit.md +3 -3
  45. package/2.guide/3.going-further/6.nuxt-app.md +1 -1
  46. package/2.guide/3.going-further/7.layers.md +50 -41
  47. package/2.guide/3.going-further/9.debugging.md +2 -2
  48. package/2.guide/4.recipes/1.custom-routing.md +19 -19
  49. package/2.guide/4.recipes/2.vite-plugin.md +3 -3
  50. package/2.guide/4.recipes/3.custom-usefetch.md +9 -9
  51. package/2.guide/4.recipes/4.sessions-and-authentication.md +33 -19
  52. package/2.guide/5.best-practices/performance.md +8 -8
  53. package/3.api/1.components/1.client-only.md +6 -3
  54. package/3.api/1.components/1.nuxt-client-fallback.md +9 -6
  55. package/3.api/1.components/11.teleports.md +4 -1
  56. package/3.api/1.components/12.nuxt-route-announcer.md +7 -7
  57. package/3.api/1.components/13.nuxt-time.md +44 -17
  58. package/3.api/1.components/2.nuxt-page.md +2 -2
  59. package/3.api/1.components/3.nuxt-layout.md +9 -4
  60. package/3.api/1.components/4.nuxt-link.md +38 -18
  61. package/3.api/1.components/6.nuxt-error-boundary.md +11 -9
  62. package/3.api/2.composables/on-prehydrate.md +2 -2
  63. package/3.api/2.composables/use-async-data.md +11 -11
  64. package/3.api/2.composables/use-cookie.md +26 -18
  65. package/3.api/2.composables/use-error.md +1 -1
  66. package/3.api/2.composables/use-fetch.md +13 -13
  67. package/3.api/2.composables/use-head-safe.md +5 -5
  68. package/3.api/2.composables/use-head.md +2 -2
  69. package/3.api/2.composables/use-hydration.md +5 -5
  70. package/3.api/2.composables/use-loading-indicator.md +10 -10
  71. package/3.api/2.composables/use-nuxt-app.md +9 -9
  72. package/3.api/2.composables/use-nuxt-data.md +7 -7
  73. package/3.api/2.composables/use-preview-mode.md +12 -15
  74. package/3.api/2.composables/use-request-fetch.md +1 -1
  75. package/3.api/2.composables/use-request-headers.md +3 -3
  76. package/3.api/2.composables/use-response-header.md +7 -8
  77. package/3.api/2.composables/use-route-announcer.md +3 -3
  78. package/3.api/2.composables/use-router.md +5 -3
  79. package/3.api/2.composables/use-runtime-config.md +6 -6
  80. package/3.api/2.composables/use-runtime-hook.md +1 -1
  81. package/3.api/2.composables/use-seo-meta.md +1 -1
  82. package/3.api/2.composables/use-server-seo-meta.md +1 -1
  83. package/3.api/2.composables/use-state.md +3 -3
  84. package/3.api/3.utils/$fetch.md +5 -3
  85. package/3.api/3.utils/abort-navigation.md +2 -2
  86. package/3.api/3.utils/add-route-middleware.md +3 -3
  87. package/3.api/3.utils/call-once.md +3 -3
  88. package/3.api/3.utils/clear-error.md +1 -1
  89. package/3.api/3.utils/clear-nuxt-data.md +2 -2
  90. package/3.api/3.utils/clear-nuxt-state.md +2 -2
  91. package/3.api/3.utils/create-error.md +1 -1
  92. package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
  93. package/3.api/3.utils/define-nuxt-component.md +5 -5
  94. package/3.api/3.utils/define-nuxt-plugin.md +11 -11
  95. package/3.api/3.utils/define-nuxt-route-middleware.md +2 -2
  96. package/3.api/3.utils/define-page-meta.md +14 -14
  97. package/3.api/3.utils/define-route-rules.md +3 -3
  98. package/3.api/3.utils/navigate-to.md +9 -9
  99. package/3.api/3.utils/preload-components.md +1 -1
  100. package/3.api/3.utils/prerender-routes.md +2 -2
  101. package/3.api/3.utils/refresh-cookie.md +3 -3
  102. package/3.api/3.utils/refresh-nuxt-data.md +9 -4
  103. package/3.api/3.utils/reload-nuxt-app.md +2 -2
  104. package/3.api/3.utils/set-response-status.md +1 -1
  105. package/3.api/3.utils/show-error.md +2 -2
  106. package/3.api/3.utils/update-app-config.md +2 -1
  107. package/3.api/4.commands/prepare.md +4 -0
  108. package/3.api/5.kit/1.modules.md +36 -36
  109. package/3.api/5.kit/10.templates.md +8 -6
  110. package/3.api/5.kit/11.nitro.md +62 -62
  111. package/3.api/5.kit/12.resolving.md +2 -2
  112. package/3.api/5.kit/14.builder.md +1 -0
  113. package/3.api/5.kit/15.examples.md +2 -2
  114. package/3.api/5.kit/16.layers.md +26 -26
  115. package/3.api/5.kit/3.compatibility.md +12 -12
  116. package/3.api/5.kit/4.autoimports.md +12 -12
  117. package/3.api/5.kit/5.components.md +5 -5
  118. package/3.api/5.kit/6.context.md +3 -3
  119. package/3.api/5.kit/7.pages.md +4 -4
  120. package/3.api/5.kit/8.layout.md +1 -1
  121. package/3.api/5.kit/9.plugins.md +5 -4
  122. package/3.api/6.advanced/2.import-meta.md +3 -3
  123. package/3.api/6.nuxt-config.md +293 -858
  124. package/6.bridge/1.overview.md +1 -1
  125. package/6.bridge/10.configuration.md +2 -1
  126. package/6.bridge/2.typescript.md +2 -2
  127. package/6.bridge/3.bridge-composition-api.md +2 -2
  128. package/6.bridge/4.plugins-and-middleware.md +5 -5
  129. package/6.bridge/5.nuxt3-compatible-api.md +11 -8
  130. package/6.bridge/6.meta.md +15 -14
  131. package/6.bridge/8.nitro.md +2 -2
  132. package/6.bridge/9.vite.md +3 -3
  133. package/7.migration/2.configuration.md +17 -15
  134. package/7.migration/4.meta.md +17 -14
  135. package/7.migration/5.plugins-and-middleware.md +5 -5
  136. package/7.migration/6.pages-and-layouts.md +15 -11
  137. package/7.migration/7.component-options.md +3 -3
  138. package/7.migration/8.runtime-config.md +3 -3
  139. package/package.json +1 -1
@@ -86,7 +86,7 @@ You can use static `import`, dynamic `import()` and `export default` instead. Us
86
86
  import { defineNuxtConfig } from '@nuxt/bridge'
87
87
 
88
88
  export default defineNuxtConfig({
89
- bridge: false
89
+ bridge: false,
90
90
  })
91
91
  ```
92
92
 
@@ -11,6 +11,7 @@ You can check [bridge/src/module.ts](https://github.com/nuxt/bridge/blob/main/pa
11
11
 
12
12
  ```ts [nuxt.config.ts]
13
13
  import { defineNuxtConfig } from '@nuxt/bridge'
14
+
14
15
  export default defineNuxtConfig({
15
16
  bridge: {
16
17
 
@@ -63,7 +64,7 @@ export default defineNuxtConfig({
63
64
 
64
65
  vite: {
65
66
  // Config for Vite
66
- }
67
+ },
67
68
  })
68
69
  ```
69
70
 
@@ -16,8 +16,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
16
16
  export default defineNuxtConfig({
17
17
  bridge: {
18
18
  typescript: true,
19
- nitro: false // If migration to Nitro is complete, set to true
20
- }
19
+ nitro: false, // If migration to Nitro is complete, set to true
20
+ },
21
21
  })
22
22
  ```
23
23
 
@@ -47,8 +47,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
47
47
  export default defineNuxtConfig({
48
48
  bridge: {
49
49
  capi: true,
50
- nitro: false // If migration to Nitro is complete, set to true
51
- }
50
+ nitro: false, // If migration to Nitro is complete, set to true
51
+ },
52
52
  })
53
53
  ```
54
54
 
@@ -9,8 +9,8 @@ You can now migrate to the Nuxt 3 plugins API, which is slightly different in fo
9
9
 
10
10
  Plugins now take only one argument (`nuxtApp`). You can find out more in [the docs](/docs/4.x/guide/directory-structure/plugins).
11
11
 
12
- ```js [app/plugins/hello.ts]
13
- export default defineNuxtPlugin(nuxtApp => {
12
+ ```ts [app/plugins/hello.ts]
13
+ export default defineNuxtPlugin((nuxtApp) => {
14
14
  nuxtApp.provide('injected', () => 'my injected function')
15
15
  // now available on `nuxtApp.$injected`
16
16
  })
@@ -54,9 +54,9 @@ import { defineNuxtConfig } from '@nuxt/bridge'
54
54
  export default defineNuxtConfig({
55
55
  bridge: {
56
56
  macros: {
57
- pageMeta: true
58
- }
59
- }
57
+ pageMeta: true,
58
+ },
59
+ },
60
60
  })
61
61
  ```
62
62
 
@@ -73,8 +73,10 @@ You can access injected helpers using `useNuxtApp`.
73
73
 
74
74
  This helper function is not provided any more but you can replace it with the following code:
75
75
 
76
- ```js
77
- const wrapProperty = (property, makeComputed = true) => () => {
76
+ ```ts
77
+ import { computed, getCurrentInstance } from 'vue'
78
+
79
+ const wrapProperty = (property: string, makeComputed = true) => () => {
78
80
  const vm = getCurrentInstance().proxy
79
81
  return makeComputed ? computed(() => vm[property]) : vm[property]
80
82
  }
@@ -136,7 +138,7 @@ In order to interact with `vue-meta`, you may use `useNuxt2Meta`, which will wor
136
138
 
137
139
  You can also pass in computed values or refs, and the meta values will be updated reactively:
138
140
 
139
- ```ts
141
+ ```vue
140
142
  <script setup>
141
143
  const title = ref('my title')
142
144
  useNuxt2Meta({
@@ -165,10 +167,11 @@ You will also need to enable it explicitly in your `nuxt.config`:
165
167
 
166
168
  ```js
167
169
  import { defineNuxtConfig } from '@nuxt/bridge'
170
+
168
171
  export default defineNuxtConfig({
169
172
  bridge: {
170
- meta: true
171
- }
173
+ meta: true,
174
+ },
172
175
  })
173
176
  ```
174
177
 
@@ -182,7 +185,7 @@ Nuxt exposes every auto-import with the `#imports` alias that can be used to mak
182
185
 
183
186
  ```vue
184
187
  <script setup lang="ts">
185
- import { ref, computed } from '#imports'
188
+ import { computed, ref } from '#imports'
186
189
 
187
190
  const count = ref(1)
188
191
  const double = computed(() => count.value * 2)
@@ -196,8 +199,8 @@ If you want to disable auto-importing composables and utilities, you can set `im
196
199
  ```ts [nuxt.config.ts]
197
200
  export default defineNuxtConfig({
198
201
  imports: {
199
- autoImport: false
200
- }
202
+ autoImport: false,
203
+ },
201
204
  })
202
205
  ```
203
206
 
@@ -13,11 +13,12 @@ If you need to use the Options API, there is a `head()` method you can use when
13
13
 
14
14
  ```js
15
15
  import { defineNuxtConfig } from '@nuxt/bridge'
16
+
16
17
  export default defineNuxtConfig({
17
18
  bridge: {
18
19
  meta: true,
19
- nitro: false // If migration to Nitro is complete, set to true
20
- }
20
+ nitro: false, // If migration to Nitro is complete, set to true
21
+ },
21
22
  })
22
23
  ```
23
24
 
@@ -34,9 +35,9 @@ export default {
34
35
  meta: [
35
36
  { charset: 'utf-8' },
36
37
  { name: 'viewport', content: 'width=device-width, initial-scale=1' },
37
- { hid: 'description', name: 'description', content: 'Meta description' }
38
- ]
39
- }
38
+ { hid: 'description', name: 'description', content: 'Meta description' },
39
+ ],
40
+ },
40
41
  }
41
42
  ```
42
43
 
@@ -48,10 +49,10 @@ export default defineNuxtConfig({
48
49
  meta: [
49
50
  { charset: 'utf-8' },
50
51
  { name: 'viewport', content: 'width=device-width, initial-scale=1' },
51
- { name: 'description', content: 'Meta description' }
52
- ]
53
- }
54
- }
52
+ { name: 'description', content: 'Meta description' },
53
+ ],
54
+ },
55
+ },
55
56
  })
56
57
  ```
57
58
 
@@ -90,10 +91,10 @@ export default defineNuxtComponent({
90
91
  return {
91
92
  meta: [{
92
93
  name: 'description',
93
- content: 'This is my page description.'
94
- }]
94
+ content: 'This is my page description.',
95
+ }],
95
96
  }
96
- }
97
+ },
97
98
  })
98
99
  </script>
99
100
  ```
@@ -110,8 +111,8 @@ If you want to use a function (for full control), then this cannot be set in you
110
111
  <script setup lang="ts">
111
112
  useHead({
112
113
  titleTemplate: (titleChunk) => {
113
- return titleChunk ? `${titleChunk} - Site Title` : 'Site Title';
114
- }
114
+ return titleChunk ? `${titleChunk} - Site Title` : 'Site Title'
115
+ },
115
116
  })
116
117
  </script>
117
118
  ```
@@ -14,8 +14,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
14
14
 
15
15
  export default defineNuxtConfig({
16
16
  bridge: {
17
- nitro: true
18
- }
17
+ nitro: true,
18
+ },
19
19
  })
20
20
  ```
21
21
 
@@ -19,8 +19,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
19
19
  export default defineNuxtConfig({
20
20
  bridge: {
21
21
  vite: true,
22
- nitro: true
23
- }
22
+ nitro: true,
23
+ },
24
24
  })
25
25
  ```
26
26
 
@@ -32,6 +32,6 @@ import { defineNuxtConfig } from '@nuxt/bridge'
32
32
  export default defineNuxtConfig({
33
33
  vite: {
34
34
  // Config for Vite
35
- }
35
+ },
36
36
  })
37
37
  ```
@@ -40,8 +40,8 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
40
40
  router: {
41
41
  extendRoutes (routes) {
42
42
  //
43
- }
44
- }
43
+ },
44
+ },
45
45
  }
46
46
  ```
47
47
 
@@ -50,8 +50,8 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
50
50
  hooks: {
51
51
  'pages:extend' (routes) {
52
52
  //
53
- }
54
- }
53
+ },
54
+ },
55
55
  })
56
56
  ```
57
57
 
@@ -64,8 +64,8 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
64
64
  ```ts [Nuxt 2]
65
65
  export default {
66
66
  router: {
67
- routeNameSplitter: '/'
68
- }
67
+ routeNameSplitter: '/',
68
+ },
69
69
  }
70
70
  ```
71
71
 
@@ -78,8 +78,10 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
78
78
  const routeNameSplitter = '/'
79
79
  const root = createResolver(import.meta.url).resolve('./pages')
80
80
 
81
- function updateName(routes) {
82
- if (!routes) return
81
+ function updateName (routes) {
82
+ if (!routes) {
83
+ return
84
+ }
83
85
 
84
86
  for (const route of routes) {
85
87
  const relativePath = route.file.substring(root.length + 1)
@@ -200,10 +202,10 @@ yarn add pinia @pinia/nuxt
200
202
  Enable the module in your nuxt configuration:
201
203
 
202
204
  ```ts [nuxt.config.ts]
203
- import { defineNuxtConfig } from 'nuxt/config';
205
+ import { defineNuxtConfig } from 'nuxt/config'
204
206
 
205
207
  export default defineNuxtConfig({
206
- modules: ['@pinia/nuxt']
208
+ modules: ['@pinia/nuxt'],
207
209
  })
208
210
  ```
209
211
 
@@ -217,7 +219,7 @@ export const useMainStore = defineStore('main', {
217
219
  counter: 0,
218
220
  }),
219
221
  actions: {
220
- increment() {
222
+ increment () {
221
223
  // `this` is the store instance
222
224
  this.counter++
223
225
  },
@@ -233,8 +235,8 @@ import { useMainStore } from '~/store'
233
235
  export default defineNuxtPlugin(({ $pinia }) => {
234
236
  return {
235
237
  provide: {
236
- store: useMainStore($pinia)
237
- }
238
+ store: useMainStore($pinia),
239
+ },
238
240
  }
239
241
  })
240
242
  ```
@@ -246,8 +248,8 @@ Once it's done you will need to add the following plugin to your Nuxt app:
246
248
  ```ts [app/plugins/vuex.ts]
247
249
  import store from '~/store'
248
250
 
249
- export default defineNuxtPlugin(nuxtApp => {
250
- nuxtApp.vueApp.use(store);
251
+ export default defineNuxtPlugin((nuxtApp) => {
252
+ nuxtApp.vueApp.use(store)
251
253
  })
252
254
  ```
253
255
 
@@ -31,18 +31,18 @@ Nuxt currently uses [`Unhead`](https://github.com/unjs/unhead) to manage your me
31
31
  export default {
32
32
  data: () => ({
33
33
  title: 'My App',
34
- description: 'My App Description'
35
- })
34
+ description: 'My App Description',
35
+ }),
36
36
  head () {
37
37
  return {
38
38
  title: this.title,
39
39
  meta: [{
40
40
  hid: 'description',
41
41
  name: 'description',
42
- content: this.description
43
- }]
42
+ content: this.description,
43
+ }],
44
44
  }
45
- }
45
+ },
46
46
  }
47
47
  </script>
48
48
  ```
@@ -57,8 +57,8 @@ useHead({
57
57
  title,
58
58
  meta: [{
59
59
  name: 'description',
60
- content: description
61
- }]
60
+ content: description,
61
+ }],
62
62
  })
63
63
  </script>
64
64
  ```
@@ -80,10 +80,10 @@ export default {
80
80
  meta: [{
81
81
  hid: 'description',
82
82
  name: 'description',
83
- content: 'My App Description'
84
- }]
83
+ content: 'My App Description',
84
+ }],
85
85
  }
86
- }
86
+ },
87
87
  }
88
88
  </script>
89
89
  ```
@@ -93,7 +93,10 @@ export default {
93
93
  <div>
94
94
  <Head>
95
95
  <Title>My App</Title>
96
- <Meta name="description" content="My app description"/>
96
+ <Meta
97
+ name="description"
98
+ content="My app description"
99
+ />
97
100
  </Head>
98
101
  <!-- -->
99
102
  </div>
@@ -118,10 +121,10 @@ export default defineNuxtComponent({
118
121
  return {
119
122
  meta: [{
120
123
  name: 'description',
121
- content: 'This is my page description.'
122
- }]
124
+ content: 'This is my page description.',
125
+ }],
123
126
  }
124
- }
127
+ },
125
128
  })
126
129
  </script>
127
130
  ```
@@ -9,22 +9,22 @@ Plugins now have a different format, and take only one argument (`nuxtApp`).
9
9
 
10
10
  ::code-group
11
11
 
12
- ```js [Nuxt 2]
12
+ ```ts [Nuxt 2]
13
13
  export default (ctx, inject) => {
14
14
  inject('injected', () => 'my injected function')
15
- })
15
+ }
16
16
  ```
17
17
 
18
18
  ```ts [Nuxt 3]
19
- export default defineNuxtPlugin(nuxtApp => {
19
+ export default defineNuxtPlugin((nuxtApp) => {
20
20
  // now available on `nuxtApp.$injected`
21
21
  nuxtApp.provide('injected', () => 'my injected function')
22
22
 
23
23
  // You can alternatively use this format, which comes with automatic type support
24
24
  return {
25
25
  provide: {
26
- injected: () => 'my injected function'
27
- }
26
+ injected: () => 'my injected function',
27
+ },
28
28
  }
29
29
  })
30
30
  ```
@@ -145,13 +145,17 @@ If you have been defining transitions for your page or layout directly in your c
145
145
  ```vue [Nuxt 2]
146
146
  <template>
147
147
  <div>
148
- <NuxtChild keep-alive :keep-alive-props="{ exclude: ['modal'] }" :nuxt-child-key="$route.slug" />
148
+ <NuxtChild
149
+ keep-alive
150
+ :keep-alive-props="{ exclude: ['modal'] }"
151
+ :nuxt-child-key="$route.slug"
152
+ />
149
153
  </div>
150
154
  </template>
151
155
 
152
156
  <script>
153
157
  export default {
154
- transition: 'page' // or { name: 'page' }
158
+ transition: 'page', // or { name: 'page' }
155
159
  }
156
160
  </script>
157
161
  ```
@@ -172,7 +176,7 @@ definePageMeta({
172
176
  name: 'page',
173
177
  },
174
178
  keepalive: {
175
- exclude: ['modal']
179
+ exclude: ['modal'],
176
180
  },
177
181
  })
178
182
  </script>
@@ -202,29 +206,29 @@ Make sure to always `await` on [`navigateTo`](/docs/4.x/api/utils/navigate-to) o
202
206
  <script>
203
207
  export default {
204
208
  methods: {
205
- navigate(){
209
+ navigate () {
206
210
  this.$router.push({
207
211
  path: '/search',
208
212
  query: {
209
213
  name: 'first name',
210
- type: '1'
211
- }
214
+ type: '1',
215
+ },
212
216
  })
213
- }
214
- }
217
+ },
218
+ },
215
219
  }
216
220
  </script>
217
221
  ```
218
222
 
219
223
  ```vue [Nuxt 3]
220
224
  <script setup lang="ts">
221
- function navigate(){
225
+ function navigate () {
222
226
  return navigateTo({
223
227
  path: '/search',
224
228
  query: {
225
229
  name: 'first name',
226
- type: '1'
227
- }
230
+ type: '1',
231
+ },
228
232
  })
229
233
  }
230
234
  </script>
@@ -30,14 +30,14 @@ In Nuxt 2, you'd fetch your data in your component using a syntax similar to:
30
30
 
31
31
  ```ts
32
32
  export default {
33
- async asyncData({ params, $http }) {
33
+ async asyncData ({ params, $http }) {
34
34
  const post = await $http.$get(`https://api.nuxtjs.dev/posts/${params.id}`)
35
35
  return { post }
36
36
  },
37
37
  // or alternatively
38
38
  fetch () {
39
39
  this.post = await $http.$get(`https://api.nuxtjs.dev/posts/${params.id}`)
40
- }
40
+ },
41
41
  }
42
42
  ```
43
43
 
@@ -48,7 +48,7 @@ With Nuxt 3, you can perform this data fetching using composables in your `setup
48
48
  ```vue
49
49
  <script setup lang="ts">
50
50
  // Define params wherever, through `defineProps()`, `useRoute()`, etc.
51
- const { data: post, refresh } = await useAsyncData('post', () => $fetch(`https://api.nuxtjs.dev/posts/${params.id}`) )
51
+ const { data: post, refresh } = await useAsyncData('post', () => $fetch(`https://api.nuxtjs.dev/posts/${params.id}`))
52
52
  // Or instead - useFetch is a convenience wrapper around useAsyncData when you're just performing a simple fetch
53
53
  const { data: post, refresh } = await useFetch(`https://api.nuxtjs.dev/posts/${params.id}`)
54
54
  </script>
@@ -25,9 +25,9 @@ export default defineNuxtConfig({
25
25
  apiSecret: '123',
26
26
  // Config within public will be also exposed to the client
27
27
  public: {
28
- apiBase: '/api'
29
- }
30
- }
28
+ apiBase: '/api',
29
+ },
30
+ },
31
31
  })
32
32
  ```
33
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "4.1.3-29314777.50febbbb",
3
+ "version": "4.1.3-29316215.910d159d",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",