@nuxt/docs-nightly 4.1.3-29313364.98ecc620 → 4.1.3-29314777.50febbbb
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.
- package/1.getting-started/01.introduction.md +4 -4
- package/1.getting-started/02.installation.md +1 -1
- package/1.getting-started/03.configuration.md +6 -6
- package/1.getting-started/04.views.md +2 -2
- package/1.getting-started/05.assets.md +1 -1
- package/1.getting-started/06.styling.md +3 -3
- package/1.getting-started/07.routing.md +5 -5
- package/1.getting-started/08.seo-meta.md +4 -4
- package/1.getting-started/10.data-fetching.md +14 -14
- package/1.getting-started/11.state-management.md +4 -4
- package/1.getting-started/12.error-handling.md +11 -11
- package/1.getting-started/13.server.md +5 -5
- package/1.getting-started/14.layers.md +1 -1
- package/1.getting-started/15.prerendering.md +4 -4
- package/1.getting-started/16.deployment.md +1 -1
- package/1.getting-started/17.testing.md +1 -1
- package/1.getting-started/18.upgrade.md +2 -2
- package/2.guide/0.index.md +5 -5
- package/2.guide/1.directory-structure/0.output.md +1 -1
- package/2.guide/1.directory-structure/1.app/1.assets.md +1 -1
- package/2.guide/1.directory-structure/1.app/1.components.md +4 -4
- package/2.guide/1.directory-structure/1.app/1.composables.md +2 -2
- package/2.guide/1.directory-structure/1.app/1.layouts.md +3 -3
- package/2.guide/1.directory-structure/1.app/1.middleware.md +3 -3
- package/2.guide/1.directory-structure/1.app/1.pages.md +6 -6
- package/2.guide/1.directory-structure/1.app/1.utils.md +2 -2
- package/2.guide/1.directory-structure/1.app/3.app-config.md +1 -1
- package/2.guide/1.directory-structure/1.app/3.app.md +3 -3
- package/2.guide/1.directory-structure/1.modules.md +1 -1
- package/2.guide/1.directory-structure/1.server.md +2 -2
- package/2.guide/1.directory-structure/1.shared.md +2 -2
- package/2.guide/1.directory-structure/2.env.md +3 -3
- package/2.guide/1.directory-structure/2.nuxtrc.md +1 -1
- package/2.guide/1.directory-structure/3.nuxt-config.md +1 -1
- package/2.guide/2.concepts/1.auto-imports.md +4 -4
- package/2.guide/2.concepts/10.nuxt-lifecycle.md +7 -7
- package/2.guide/2.concepts/2.vuejs-development.md +4 -4
- package/2.guide/2.concepts/3.rendering.md +3 -3
- package/2.guide/2.concepts/4.server-engine.md +1 -1
- package/2.guide/2.concepts/5.modules.md +1 -1
- package/2.guide/2.concepts/7.esm.md +2 -2
- package/2.guide/3.going-further/1.events.md +1 -1
- package/2.guide/3.going-further/1.experimental-features.md +4 -4
- package/2.guide/3.going-further/10.runtime-config.md +1 -1
- package/2.guide/3.going-further/11.nightly-release-channel.md +1 -1
- package/2.guide/3.going-further/2.hooks.md +3 -3
- package/2.guide/3.going-further/3.modules.md +7 -7
- package/2.guide/3.going-further/4.kit.md +2 -2
- package/2.guide/3.going-further/6.nuxt-app.md +3 -3
- package/2.guide/3.going-further/7.layers.md +1 -1
- package/2.guide/4.recipes/3.custom-usefetch.md +1 -1
- package/2.guide/4.recipes/4.sessions-and-authentication.md +1 -1
- package/2.guide/5.best-practices/performance.md +5 -5
- package/3.api/1.components/1.nuxt-client-fallback.md +1 -1
- package/3.api/1.components/11.teleports.md +1 -1
- package/3.api/1.components/2.nuxt-page.md +2 -2
- package/3.api/1.components/3.nuxt-layout.md +4 -4
- package/3.api/1.components/4.nuxt-link.md +2 -2
- package/3.api/1.components/5.nuxt-loading-indicator.md +1 -1
- package/3.api/1.components/6.nuxt-error-boundary.md +1 -1
- package/3.api/2.composables/use-app-config.md +1 -1
- package/3.api/2.composables/use-async-data.md +3 -3
- package/3.api/2.composables/use-cookie.md +1 -1
- package/3.api/2.composables/use-error.md +1 -1
- package/3.api/2.composables/use-fetch.md +4 -4
- package/3.api/2.composables/use-head.md +1 -1
- package/3.api/2.composables/use-lazy-async-data.md +2 -2
- package/3.api/2.composables/use-lazy-fetch.md +2 -2
- package/3.api/2.composables/use-nuxt-app.md +1 -1
- package/3.api/2.composables/use-router.md +1 -1
- package/3.api/2.composables/use-runtime-config.md +5 -5
- package/3.api/2.composables/use-seo-meta.md +2 -2
- package/3.api/2.composables/use-server-seo-meta.md +2 -2
- package/3.api/2.composables/use-state.md +1 -1
- package/3.api/3.utils/$fetch.md +1 -1
- package/3.api/3.utils/call-once.md +2 -2
- package/3.api/3.utils/clear-error.md +1 -1
- package/3.api/3.utils/create-error.md +1 -1
- package/3.api/3.utils/define-nuxt-plugin.md +1 -1
- package/3.api/3.utils/define-page-meta.md +2 -2
- package/3.api/3.utils/define-route-rules.md +2 -2
- package/3.api/3.utils/navigate-to.md +1 -1
- package/3.api/3.utils/preload-route-components.md +2 -2
- package/3.api/3.utils/refresh-cookie.md +1 -1
- package/3.api/3.utils/refresh-nuxt-data.md +1 -1
- package/3.api/3.utils/reload-nuxt-app.md +1 -1
- package/3.api/3.utils/set-response-status.md +1 -1
- package/3.api/3.utils/show-error.md +1 -1
- package/3.api/3.utils/update-app-config.md +1 -1
- package/3.api/4.commands/generate.md +1 -1
- package/3.api/4.commands/typecheck.md +1 -1
- package/3.api/6.advanced/1.hooks.md +1 -1
- package/3.api/6.nuxt-config.md +6 -6
- package/3.api/index.md +7 -7
- package/5.community/4.contribution.md +5 -5
- package/5.community/5.framework-contribution.md +1 -1
- package/6.bridge/3.bridge-composition-api.md +2 -2
- package/6.bridge/5.nuxt3-compatible-api.md +1 -1
- package/7.migration/10.bundling.md +1 -1
- package/7.migration/11.server.md +3 -3
- package/7.migration/2.configuration.md +1 -1
- package/7.migration/20.module-authors.md +1 -1
- package/7.migration/4.meta.md +1 -1
- package/7.migration/5.plugins-and-middleware.md +3 -3
- package/7.migration/6.pages-and-layouts.md +5 -5
- package/7.migration/7.component-options.md +4 -4
- package/7.migration/8.runtime-config.md +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ description: Nuxt provides a powerful system that allows you to extend the defau
|
|
|
5
5
|
|
|
6
6
|
Nuxt layers are a powerful feature that you can use to share and reuse partial Nuxt applications within a monorepo, or from a git repository or npm package. The layers structure is almost identical to a standard Nuxt application, which makes them easy to author and maintain.
|
|
7
7
|
|
|
8
|
-
:read-more{to="/docs/getting-started/layers"}
|
|
8
|
+
:read-more{to="/docs/4.x/getting-started/layers"}
|
|
9
9
|
|
|
10
10
|
A minimal Nuxt layer directory should contain a [`nuxt.config.ts`](/docs/4.x/guide/directory-structure/nuxt-config) file to indicate it is a layer.
|
|
11
11
|
|
|
@@ -116,7 +116,7 @@ export function useAPI<T>(
|
|
|
116
116
|
This example demonstrates how to use a custom `useFetch`, but the same structure is identical for a custom `useAsyncData`.
|
|
117
117
|
::
|
|
118
118
|
|
|
119
|
-
:link-example{to="/docs/examples/advanced/use-custom-fetch-composable"}
|
|
119
|
+
:link-example{to="/docs/4.x/examples/advanced/use-custom-fetch-composable"}
|
|
120
120
|
|
|
121
121
|
:video-accordion{title="Watch a video about custom $fetch and Repository Pattern in Nuxt" videoId="jXH8Tr-exhI"}
|
|
122
122
|
|
|
@@ -143,7 +143,7 @@ export default defineEventHandler(async (event) => {
|
|
|
143
143
|
|
|
144
144
|
## Protect App Routes
|
|
145
145
|
|
|
146
|
-
Our data is safe with the server-side route in place, but without doing anything else, unauthenticated users would probably get some odd data when trying to access the `/users` page. We should create a [client-side middleware](https://nuxt.com/docs/guide/directory-structure/app/middleware) to protect the route on the client side and redirect users to the login page.
|
|
146
|
+
Our data is safe with the server-side route in place, but without doing anything else, unauthenticated users would probably get some odd data when trying to access the `/users` page. We should create a [client-side middleware](https://nuxt.com/docs/4.x/guide/directory-structure/app/middleware) to protect the route on the client side and redirect users to the login page.
|
|
147
147
|
|
|
148
148
|
`nuxt-auth-utils` provides a convenient `useUserSession` composable which we'll use to check if the user is logged in, and redirect them if they are not.
|
|
149
149
|
|
|
@@ -39,7 +39,7 @@ export default defineNuxtConfig({
|
|
|
39
39
|
})
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
:read-more{title="NuxtLink" to="/docs/api/components/nuxt-link"}
|
|
42
|
+
:read-more{title="NuxtLink" to="/docs/4.x/api/components/nuxt-link"}
|
|
43
43
|
|
|
44
44
|
### Hybrid Rendering
|
|
45
45
|
|
|
@@ -68,7 +68,7 @@ export default defineNuxtConfig({
|
|
|
68
68
|
|
|
69
69
|
Nuxt server will automatically register corresponding middleware and wrap routes with cache handlers using Nitro caching layer.
|
|
70
70
|
|
|
71
|
-
:read-more{title="Hybrid rendering" to="/docs/guide/concepts/rendering#hybrid-rendering"}
|
|
71
|
+
:read-more{title="Hybrid rendering" to="/docs/4.x/guide/concepts/rendering#hybrid-rendering"}
|
|
72
72
|
|
|
73
73
|
### Lazy Loading Components
|
|
74
74
|
|
|
@@ -90,7 +90,7 @@ const show = ref(false)
|
|
|
90
90
|
|
|
91
91
|
By using the Lazy prefix you can delay loading the component code until the right moment, which can be helpful for optimizing your JavaScript bundle size.
|
|
92
92
|
|
|
93
|
-
:read-more{title="Lazy loading components" to="/docs/guide/directory-structure/app/components#dynamic-imports"}
|
|
93
|
+
:read-more{title="Lazy loading components" to="/docs/4.x/guide/directory-structure/app/components#dynamic-imports"}
|
|
94
94
|
|
|
95
95
|
### Lazy Hydration
|
|
96
96
|
|
|
@@ -106,13 +106,13 @@ It is not always necessary to hydrate (or make interactive) all the components o
|
|
|
106
106
|
|
|
107
107
|
To optimize your app, you may want to delay the hydration of some components until they're visible, or until the browser is done with more important tasks.
|
|
108
108
|
|
|
109
|
-
:read-more{title="Lazy hydration" to="/docs/guide/directory-structure/app/components#delayed-or-lazy-hydration"}
|
|
109
|
+
:read-more{title="Lazy hydration" to="/docs/4.x/guide/directory-structure/app/components#delayed-or-lazy-hydration"}
|
|
110
110
|
|
|
111
111
|
### Fetching data
|
|
112
112
|
|
|
113
113
|
To avoid fetching same data twice (once on the server and once on client) Nuxt provides [`useFetch`](/docs/4.x/api/composables/use-fetch) and [`useAsyncData`](/docs/4.x/api/composables/use-async-data). They ensure that if an API call is made on the server, the data is forwarded to the client in the payload instead of being fetched again.
|
|
114
114
|
|
|
115
|
-
:read-more{title="Data fetching" to="/docs/getting-started/data-fetching"}
|
|
115
|
+
:read-more{title="Data fetching" to="/docs/4.x/getting-started/data-fetching"}
|
|
116
116
|
|
|
117
117
|
## Core Nuxt Modules
|
|
118
118
|
|
|
@@ -14,7 +14,7 @@ links:
|
|
|
14
14
|
|
|
15
15
|
Nuxt provides the `<NuxtClientFallback>` component to render its content on the client if any of its children trigger an error in SSR.
|
|
16
16
|
|
|
17
|
-
::note{to="/docs/guide/going-further/experimental-features#clientfallback"}
|
|
17
|
+
::note{to="/docs/4.x/guide/going-further/experimental-features#clientfallback"}
|
|
18
18
|
This component is experimental and in order to use it you must enable the `experimental.clientFallback` option in your `nuxt.config`.
|
|
19
19
|
::
|
|
20
20
|
|
|
@@ -89,7 +89,7 @@ definePageMeta({
|
|
|
89
89
|
</script>
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
:link-example{to="/docs/examples/routing/pages"}
|
|
92
|
+
:link-example{to="/docs/4.x/examples/routing/pages"}
|
|
93
93
|
|
|
94
94
|
## Page's Ref
|
|
95
95
|
|
|
@@ -151,4 +151,4 @@ console.log(attrs.foobar) // Outputs: 123
|
|
|
151
151
|
</script>
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
:read-more{to="/docs/guide/directory-structure/app/pages"}
|
|
154
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/pages"}
|
|
@@ -18,7 +18,7 @@ You can use `<NuxtLayout />` component to activate the `default` layout on `app.
|
|
|
18
18
|
</template>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
:read-more{to="/docs/guide/directory-structure/app/layouts"}
|
|
21
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/layouts"}
|
|
22
22
|
|
|
23
23
|
## Props
|
|
24
24
|
|
|
@@ -51,7 +51,7 @@ Please note the layout name is normalized to kebab-case, so if your layout file
|
|
|
51
51
|
</template>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
::read-more{to="/docs/guide/directory-structure/app/layouts"}
|
|
54
|
+
::read-more{to="/docs/4.x/guide/directory-structure/app/layouts"}
|
|
55
55
|
Read more about dynamic layouts.
|
|
56
56
|
::
|
|
57
57
|
|
|
@@ -111,7 +111,7 @@ console.log(layoutCustomProps.title) // I am a custom layout
|
|
|
111
111
|
|
|
112
112
|
::
|
|
113
113
|
|
|
114
|
-
:read-more{to="/docs/getting-started/transitions"}
|
|
114
|
+
:read-more{to="/docs/4.x/getting-started/transitions"}
|
|
115
115
|
|
|
116
116
|
## Layout's Ref
|
|
117
117
|
|
|
@@ -153,4 +153,4 @@ defineExpose({
|
|
|
153
153
|
|
|
154
154
|
::
|
|
155
155
|
|
|
156
|
-
:read-more{to="/docs/guide/directory-structure/app/layouts"}
|
|
156
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/layouts"}
|
|
@@ -249,7 +249,7 @@ When not using `external`, `<NuxtLink>` supports all Vue Router's [`RouterLink`
|
|
|
249
249
|
- `rel`: A `rel` attribute value to apply on the link. Defaults to `"noopener noreferrer"` for external links.
|
|
250
250
|
|
|
251
251
|
::tip
|
|
252
|
-
Defaults can be overwritten, see [overwriting defaults](/docs/api/components/nuxt-link#overwriting-defaults) if you want to change them.
|
|
252
|
+
Defaults can be overwritten, see [overwriting defaults](/docs/4.x/api/components/nuxt-link#overwriting-defaults) if you want to change them.
|
|
253
253
|
::
|
|
254
254
|
|
|
255
255
|
## Overwriting Defaults
|
|
@@ -323,4 +323,4 @@ function defineNuxtLink(options: NuxtLinkOptions): Component {}
|
|
|
323
323
|
- `prefetchOn`: Granular control of which prefetch strategies to apply by default.
|
|
324
324
|
- `prefetchedClass`: A default class to apply to links that have been prefetched.
|
|
325
325
|
|
|
326
|
-
:link-example{to="/docs/examples/routing/pages"}
|
|
326
|
+
:link-example{to="/docs/4.x/examples/routing/pages"}
|
|
@@ -74,7 +74,7 @@ const { data: user } = useAsyncData(
|
|
|
74
74
|
[`useAsyncData`](/docs/4.x/api/composables/use-async-data) is a reserved function name transformed by the compiler, so you should not name your own function [`useAsyncData`](/docs/4.x/api/composables/use-async-data).
|
|
75
75
|
::
|
|
76
76
|
|
|
77
|
-
:read-more{to="/docs/getting-started/data-fetching#useasyncdata"}
|
|
77
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching#useasyncdata"}
|
|
78
78
|
|
|
79
79
|
## Params
|
|
80
80
|
|
|
@@ -107,7 +107,7 @@ The `handler` function should be **side-effect free** to ensure predictable beha
|
|
|
107
107
|
Under the hood, `lazy: false` uses `<Suspense>` to block the loading of the route before the data has been fetched. Consider using `lazy: true` and implementing a loading state instead for a snappier user experience.
|
|
108
108
|
::
|
|
109
109
|
|
|
110
|
-
::read-more{to="/docs/api/composables/use-lazy-async-data"}
|
|
110
|
+
::read-more{to="/docs/4.x/api/composables/use-lazy-async-data"}
|
|
111
111
|
You can use `useLazyAsyncData` to have the same behavior as `lazy: true` with `useAsyncData`.
|
|
112
112
|
::
|
|
113
113
|
|
|
@@ -213,4 +213,4 @@ interface AsyncDataExecuteOptions {
|
|
|
213
213
|
type AsyncDataRequestStatus = 'idle' | 'pending' | 'success' | 'error'
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
216
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching"}
|
|
@@ -96,7 +96,7 @@ If you encounter the `data` variable destructured from a `useFetch` returns a st
|
|
|
96
96
|
|
|
97
97
|
:video-accordion{title="Watch the video from Alexander Lichter to avoid using useFetch the wrong way" videoId="njsGVmcWviY"}
|
|
98
98
|
|
|
99
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
99
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching"}
|
|
100
100
|
|
|
101
101
|
### Reactive Fetch Options
|
|
102
102
|
|
|
@@ -201,7 +201,7 @@ type AsyncDataRequestStatus = 'idle' | 'pending' | 'success' | 'error'
|
|
|
201
201
|
| `watch` | `MultiWatchSources \| false` | - | Array of reactive sources to watch and auto-refresh. `false` disables watching. |
|
|
202
202
|
| `deep` | `boolean` | `false` | Return data in a deep ref object. |
|
|
203
203
|
| `dedupe` | `'cancel' \| 'defer'` | `'cancel'` | Avoid fetching same key more than once at a time. |
|
|
204
|
-
| `$fetch` | `typeof globalThis.$fetch` | - | Custom $fetch implementation. See [Custom useFetch in Nuxt](/docs/guide/recipes/custom-usefetch) |
|
|
204
|
+
| `$fetch` | `typeof globalThis.$fetch` | - | Custom $fetch implementation. See [Custom useFetch in Nuxt](/docs/4.x/guide/recipes/custom-usefetch) |
|
|
205
205
|
|
|
206
206
|
::note
|
|
207
207
|
All fetch options can be given a `computed` or `ref` value. These will be watched and new requests made automatically with any new values if they are updated.
|
|
@@ -240,6 +240,6 @@ If you have not fetched data on the server (for example, with `server: false`),
|
|
|
240
240
|
|
|
241
241
|
### Examples
|
|
242
242
|
|
|
243
|
-
:link-example{to="/docs/examples/advanced/use-custom-fetch-composable"}
|
|
243
|
+
:link-example{to="/docs/4.x/examples/advanced/use-custom-fetch-composable"}
|
|
244
244
|
|
|
245
|
-
:link-example{to="/docs/examples/features/data-fetching"}
|
|
245
|
+
:link-example{to="/docs/4.x/examples/features/data-fetching"}
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
The [`useHead`](/docs/4.x/api/composables/use-head) composable function allows you to manage your head tags in a programmatic and reactive way, powered by [Unhead](https://unhead.unjs.io). If the data comes from a user or other untrusted source, we recommend you check out [`useHeadSafe`](/docs/4.x/api/composables/use-head-safe).
|
|
12
12
|
|
|
13
|
-
:read-more{to="/docs/getting-started/seo-meta"}
|
|
13
|
+
:read-more{to="/docs/4.x/getting-started/seo-meta"}
|
|
14
14
|
|
|
15
15
|
## Type
|
|
16
16
|
|
|
@@ -16,7 +16,7 @@ By default, [`useAsyncData`](/docs/4.x/api/composables/use-async-data) blocks na
|
|
|
16
16
|
`useLazyAsyncData` has the same signature as [`useAsyncData`](/docs/4.x/api/composables/use-async-data).
|
|
17
17
|
::
|
|
18
18
|
|
|
19
|
-
:read-more{to="/docs/api/composables/use-async-data"}
|
|
19
|
+
:read-more{to="/docs/4.x/api/composables/use-async-data"}
|
|
20
20
|
|
|
21
21
|
## Example
|
|
22
22
|
|
|
@@ -44,4 +44,4 @@ watch(count, (newCount) => {
|
|
|
44
44
|
`useLazyAsyncData` is a reserved function name transformed by the compiler, so you should not name your own function `useLazyAsyncData`.
|
|
45
45
|
::
|
|
46
46
|
|
|
47
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
47
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching"}
|
|
@@ -20,7 +20,7 @@ By default, [`useFetch`](/docs/4.x/api/composables/use-fetch) blocks navigation
|
|
|
20
20
|
Awaiting `useLazyFetch` in this mode only ensures the call is initialized. On client-side navigation, data may not be immediately available, and you should make sure to handle the pending state in your app.
|
|
21
21
|
::
|
|
22
22
|
|
|
23
|
-
:read-more{to="/docs/api/composables/use-fetch"}
|
|
23
|
+
:read-more{to="/docs/4.x/api/composables/use-fetch"}
|
|
24
24
|
|
|
25
25
|
## Example
|
|
26
26
|
|
|
@@ -52,4 +52,4 @@ watch(posts, (newPosts) => {
|
|
|
52
52
|
`useLazyFetch` is a reserved function name transformed by the compiler, so you should not name your own function `useLazyFetch`.
|
|
53
53
|
::
|
|
54
54
|
|
|
55
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
55
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching"}
|
|
@@ -268,7 +268,7 @@ Using a new experimental feature, it is possible to enable native async context
|
|
|
268
268
|
Native async context support works currently in Bun and Node.
|
|
269
269
|
::
|
|
270
270
|
|
|
271
|
-
:read-more{to="/docs/guide/going-further/experimental-features#asynccontext"}
|
|
271
|
+
:read-more{to="/docs/4.x/guide/going-further/experimental-features#asynccontext"}
|
|
272
272
|
|
|
273
273
|
## tryUseNuxtApp
|
|
274
274
|
|
|
@@ -78,7 +78,7 @@ Read more about the browser's History API.
|
|
|
78
78
|
|
|
79
79
|
However, Nuxt has a concept of **route middleware** that simplifies the implementation of navigation guards and provides a better developer experience.
|
|
80
80
|
|
|
81
|
-
:read-more{to="/docs/guide/directory-structure/app/middleware"}
|
|
81
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/middleware"}
|
|
82
82
|
|
|
83
83
|
## Promise and Error Handling
|
|
84
84
|
|
|
@@ -22,7 +22,7 @@ export default defineEventHandler((event) => {
|
|
|
22
22
|
})
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
:read-more{to="/docs/guide/going-further/runtime-config"}
|
|
25
|
+
:read-more{to="/docs/4.x/guide/going-further/runtime-config"}
|
|
26
26
|
|
|
27
27
|
## Define Runtime Config
|
|
28
28
|
|
|
@@ -48,7 +48,7 @@ export default defineNuxtConfig({
|
|
|
48
48
|
Variables that need to be accessible on the server are added directly inside `runtimeConfig`. Variables that need to be accessible on both the client and the server are defined in `runtimeConfig.public`.
|
|
49
49
|
::
|
|
50
50
|
|
|
51
|
-
:read-more{to="/docs/guide/going-further/runtime-config"}
|
|
51
|
+
:read-more{to="/docs/4.x/guide/going-further/runtime-config"}
|
|
52
52
|
|
|
53
53
|
## Access Runtime Config
|
|
54
54
|
|
|
@@ -76,7 +76,7 @@ In this example, since `apiBase` is defined within the `public` namespace, it is
|
|
|
76
76
|
|
|
77
77
|
It is possible to update runtime config values using a matching environment variable name prefixed with `NUXT_`.
|
|
78
78
|
|
|
79
|
-
:read-more{to="/docs/guide/going-further/runtime-config"}
|
|
79
|
+
:read-more{to="/docs/4.x/guide/going-further/runtime-config"}
|
|
80
80
|
|
|
81
81
|
### Using the `.env` File
|
|
82
82
|
|
|
@@ -95,7 +95,7 @@ Any environment variables set within `.env` file are accessed using `process.env
|
|
|
95
95
|
In **production runtime**, you should use platform environment variables and `.env` is not used.
|
|
96
96
|
::
|
|
97
97
|
|
|
98
|
-
:read-more{to="/docs/guide/directory-structure/env"}
|
|
98
|
+
:read-more{to="/docs/4.x/guide/directory-structure/env"}
|
|
99
99
|
|
|
100
100
|
## `app` namespace
|
|
101
101
|
|
|
@@ -139,4 +139,4 @@ export default defineEventHandler((event) => {
|
|
|
139
139
|
})
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
:read-more{to="/docs/guide/going-further/runtime-config"}
|
|
142
|
+
:read-more{to="/docs/4.x/guide/going-further/runtime-config"}
|
|
@@ -14,7 +14,7 @@ This helps you avoid common mistakes, such as using `name` instead of `property`
|
|
|
14
14
|
This is the recommended way to add meta tags to your site as it is XSS safe and has full TypeScript support.
|
|
15
15
|
::
|
|
16
16
|
|
|
17
|
-
:read-more{to="/docs/getting-started/seo-meta"}
|
|
17
|
+
:read-more{to="/docs/4.x/getting-started/seo-meta"}
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
@@ -48,7 +48,7 @@ useSeoMeta({
|
|
|
48
48
|
|
|
49
49
|
There are over 100 parameters. See the [full list of parameters in the source code](https://github.com/harlan-zw/zhead/blob/main/packages/zhead/src/metaFlat.ts#L1035).
|
|
50
50
|
|
|
51
|
-
:read-more{to="/docs/getting-started/seo-meta"}
|
|
51
|
+
:read-more{to="/docs/4.x/getting-started/seo-meta"}
|
|
52
52
|
|
|
53
53
|
## Performance
|
|
54
54
|
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
Just like [`useSeoMeta`](/docs/4.x/api/composables/use-seo-meta), `useServerSeoMeta` composable lets you define your site's SEO meta tags as a flat object with full TypeScript support.
|
|
12
12
|
|
|
13
|
-
:read-more{to="/docs/api/composables/use-seo-meta"}
|
|
13
|
+
:read-more{to="/docs/4.x/api/composables/use-seo-meta"}
|
|
14
14
|
|
|
15
15
|
In most instances, the meta doesn't need to be reactive as robots will only scan the initial load. So we recommend using [`useServerSeoMeta`](/docs/4.x/api/composables/use-server-seo-meta) as a performance-focused utility that will not do anything (or return a `head` object) on the client.
|
|
16
16
|
|
|
@@ -24,4 +24,4 @@ useServerSeoMeta({
|
|
|
24
24
|
|
|
25
25
|
Parameters are exactly the same as with [`useSeoMeta`](/docs/4.x/api/composables/use-seo-meta)
|
|
26
26
|
|
|
27
|
-
:read-more{to="/docs/getting-started/seo-meta"}
|
|
27
|
+
:read-more{to="/docs/4.x/getting-started/seo-meta"}
|
|
@@ -15,7 +15,7 @@ links:
|
|
|
15
15
|
const count = useState('counter', () => Math.round(Math.random() * 100))
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
:read-more{to="/docs/getting-started/state-management"}
|
|
18
|
+
:read-more{to="/docs/4.x/getting-started/state-management"}
|
|
19
19
|
|
|
20
20
|
::important
|
|
21
21
|
Because the data inside `useState` will be serialized to JSON, it is important that it does not contain anything that cannot be serialized, such as classes, functions or symbols.
|
package/3.api/3.utils/$fetch.md
CHANGED
|
@@ -35,7 +35,7 @@ const { data } = await useFetch('/api/item')
|
|
|
35
35
|
</script>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
38
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching"}
|
|
39
39
|
|
|
40
40
|
You can use `$fetch` in any methods that are executed only on client-side.
|
|
41
41
|
|
|
@@ -54,11 +54,11 @@ await callOnce(async () => {
|
|
|
54
54
|
`navigation` mode is available since [Nuxt v3.15](/blog/v3-15).
|
|
55
55
|
::
|
|
56
56
|
|
|
57
|
-
::tip{to="/docs/getting-started/state-management#usage-with-pinia"}
|
|
57
|
+
::tip{to="/docs/4.x/getting-started/state-management#usage-with-pinia"}
|
|
58
58
|
`callOnce` is useful in combination with the [Pinia module](/modules/pinia) to call store actions.
|
|
59
59
|
::
|
|
60
60
|
|
|
61
|
-
:read-more{to="/docs/getting-started/state-management"}
|
|
61
|
+
:read-more{to="/docs/4.x/getting-started/state-management"}
|
|
62
62
|
|
|
63
63
|
::warning
|
|
64
64
|
Note that `callOnce` doesn't return anything. You should use [`useAsyncData`](/docs/4.x/api/composables/use-async-data) or [`useFetch`](/docs/4.x/api/composables/use-fetch) if you want to do data fetching during SSR.
|
|
@@ -26,4 +26,4 @@ clearError({ redirect: '/homepage' })
|
|
|
26
26
|
|
|
27
27
|
Errors are set in state using [`useError()`](/docs/4.x/api/composables/use-error). The `clearError` composable will reset this state and calls the `app:error:cleared` hook with the provided options.
|
|
28
28
|
|
|
29
|
-
:read-more{to="/docs/getting-started/error-handling"}
|
|
29
|
+
:read-more{to="/docs/4.x/getting-started/error-handling"}
|
|
@@ -52,4 +52,4 @@ export default eventHandler(() => {
|
|
|
52
52
|
|
|
53
53
|
In API routes, using `createError` by passing an object with a short `statusMessage` is recommended because it can be accessed on the client side. Otherwise, a `message` passed to `createError` on an API route will not propagate to the client. Alternatively, you can use the `data` property to pass data back to the client. In any case, always consider avoiding to put dynamic user input to the message to avoid potential security issues.
|
|
54
54
|
|
|
55
|
-
:read-more{to="/docs/getting-started/error-handling"}
|
|
55
|
+
:read-more{to="/docs/4.x/getting-started/error-handling"}
|
|
@@ -18,7 +18,7 @@ definePageMeta({
|
|
|
18
18
|
</script>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
:read-more{to="/docs/guide/directory-structure/app/pages#page-metadata"}
|
|
21
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/pages#page-metadata"}
|
|
22
22
|
|
|
23
23
|
## Type
|
|
24
24
|
|
|
@@ -62,7 +62,7 @@ interface PageMeta {
|
|
|
62
62
|
|
|
63
63
|
- **Type**: `string`
|
|
64
64
|
|
|
65
|
-
You may define a [custom regular expression](/docs/api/composables/use-nuxt-app#using-a-custom-regular-expression) if you have a more complex pattern than can be expressed with the file name.
|
|
65
|
+
You may define a [custom regular expression](/docs/4.x/api/composables/use-nuxt-app#using-a-custom-regular-expression) if you have a more complex pattern than can be expressed with the file name.
|
|
66
66
|
|
|
67
67
|
**`props`**
|
|
68
68
|
|
|
@@ -8,7 +8,7 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
::read-more{to="/docs/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
|
|
11
|
+
::read-more{to="/docs/4.x/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
|
|
12
12
|
This feature is experimental and in order to use it you must enable the `experimental.inlineRouteRules` option in your `nuxt.config`.
|
|
13
13
|
::
|
|
14
14
|
|
|
@@ -47,6 +47,6 @@ When running [`nuxt build`](/docs/4.x/api/commands/build), the home page will be
|
|
|
47
47
|
|
|
48
48
|
For more control, such as if you are using a custom `path` or `alias` set in the page's [`definePageMeta`](/docs/4.x/api/utils/define-page-meta), you should set `routeRules` directly within your `nuxt.config`.
|
|
49
49
|
|
|
50
|
-
::read-more{to="/docs/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
|
|
50
|
+
::read-more{to="/docs/4.x/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
|
|
51
51
|
Read more about the `routeRules`.
|
|
52
52
|
::
|
|
@@ -68,7 +68,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
|
|
|
68
68
|
|
|
69
69
|
In this case, `navigateTo` will be executed but not returned, which may lead to unexpected behavior.
|
|
70
70
|
|
|
71
|
-
:read-more{to="/docs/guide/directory-structure/app/middleware"}
|
|
71
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/middleware"}
|
|
72
72
|
|
|
73
73
|
### Navigating to an External URL
|
|
74
74
|
|
|
@@ -14,7 +14,7 @@ Preloading routes loads the components of a given route that the user might navi
|
|
|
14
14
|
Nuxt already automatically preloads the necessary routes if you're using the `NuxtLink` component.
|
|
15
15
|
::
|
|
16
16
|
|
|
17
|
-
:read-more{to="/docs/api/components/nuxt-link"}
|
|
17
|
+
:read-more{to="/docs/4.x/api/components/nuxt-link"}
|
|
18
18
|
|
|
19
19
|
## Example
|
|
20
20
|
|
|
@@ -34,7 +34,7 @@ const submit = async () => {
|
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
:read-more{to="/docs/api/utils/navigate-to"}
|
|
37
|
+
:read-more{to="/docs/4.x/api/utils/navigate-to"}
|
|
38
38
|
|
|
39
39
|
::note
|
|
40
40
|
On server, `preloadRouteComponents` will have no effect.
|
|
@@ -35,7 +35,7 @@ const loggedIn = computed(() => !!tokenCookie.value)
|
|
|
35
35
|
</script>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
::note{to="/docs/guide/going-further/experimental-features#cookiestore"}
|
|
38
|
+
::note{to="/docs/4.x/guide/going-further/experimental-features#cookiestore"}
|
|
39
39
|
You can enable experimental `cookieStore` option to automatically refresh `useCookie` value when cookie changes in the browser.
|
|
40
40
|
::
|
|
41
41
|
|
|
@@ -88,4 +88,4 @@ async function refresh () {
|
|
|
88
88
|
If you have access to the `asyncData` instance, it is recommended to use its `refresh` or `execute` method as the preferred way to refetch the data.
|
|
89
89
|
::
|
|
90
90
|
|
|
91
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
91
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching"}
|
|
@@ -14,7 +14,7 @@ links:
|
|
|
14
14
|
|
|
15
15
|
By default, it will also save the current `state` of your app (that is, any state you could access with `useState`).
|
|
16
16
|
|
|
17
|
-
::read-more{to="/docs/guide/going-further/experimental-features#restorestate" icon="i-lucide-star"}
|
|
17
|
+
::read-more{to="/docs/4.x/guide/going-further/experimental-features#restorestate" icon="i-lucide-star"}
|
|
18
18
|
You can enable experimental restoration of this state by enabling the `experimental.restoreState` option in your `nuxt.config` file.
|
|
19
19
|
::
|
|
20
20
|
|
|
@@ -36,6 +36,6 @@ Option | Default | Description
|
|
|
36
36
|
`--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server)
|
|
37
37
|
<!--/generate-opts-->
|
|
38
38
|
|
|
39
|
-
::read-more{to="/docs/getting-started/deployment#static-hosting"}
|
|
39
|
+
::read-more{to="/docs/4.x/getting-started/deployment#static-hosting"}
|
|
40
40
|
Read more about pre-rendering and static hosting.
|
|
41
41
|
::
|
|
@@ -37,6 +37,6 @@ Option | Default | Description
|
|
|
37
37
|
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a [`.env`](/docs/4.x/guide/directory-structure/env) file or as a command-line argument.
|
|
38
38
|
::
|
|
39
39
|
|
|
40
|
-
::read-more{to="/docs/guide/concepts/typescript#type-checking"}
|
|
40
|
+
::read-more{to="/docs/4.x/guide/concepts/typescript#type-checking"}
|
|
41
41
|
Read more on how to enable type-checking at build or development time.
|
|
42
42
|
::
|