@nuxt/docs 4.1.2 → 4.2.0
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 +6 -6
- package/1.getting-started/02.installation.md +3 -2
- package/1.getting-started/03.configuration.md +36 -36
- package/1.getting-started/04.views.md +9 -9
- package/1.getting-started/05.assets.md +15 -9
- package/1.getting-started/06.styling.md +58 -48
- package/1.getting-started/07.routing.md +17 -17
- package/1.getting-started/08.seo-meta.md +59 -46
- package/1.getting-started/09.transitions.md +49 -44
- package/1.getting-started/10.data-fetching.md +104 -81
- package/1.getting-started/11.state-management.md +26 -19
- package/1.getting-started/12.error-handling.md +22 -20
- package/1.getting-started/13.server.md +8 -8
- package/1.getting-started/14.layers.md +22 -16
- package/1.getting-started/15.prerendering.md +32 -32
- package/1.getting-started/16.deployment.md +10 -10
- package/1.getting-started/17.testing.md +44 -44
- package/1.getting-started/18.upgrade.md +241 -110
- package/2.guide/0.index.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/.navigation.yml +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/0.nuxt.md +3 -3
- package/2.guide/1.directory-structure/0.output.md +18 -0
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/.navigation.yml +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.assets.md +4 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.components.md +45 -28
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.composables.md +13 -13
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.layouts.md +19 -15
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.middleware.md +31 -25
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.pages.md +39 -37
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.plugins.md +25 -25
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.utils.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app-config.md +18 -18
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.error.md +6 -6
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.content.md +7 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.modules.md +8 -8
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.node_modules.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.public.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.server.md +35 -35
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.shared.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.env.md +8 -8
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.gitignore.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtignore.md +5 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtrc.md +4 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.nuxt-config.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.package.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.tsconfig.md +3 -3
- package/2.guide/{1.concepts → 2.concepts}/1.auto-imports.md +22 -22
- package/2.guide/{1.concepts → 2.concepts}/10.nuxt-lifecycle.md +17 -17
- package/2.guide/{1.concepts → 2.concepts}/2.vuejs-development.md +13 -13
- package/2.guide/{1.concepts → 2.concepts}/3.rendering.md +24 -22
- package/2.guide/{1.concepts → 2.concepts}/4.server-engine.md +6 -6
- package/2.guide/{1.concepts → 2.concepts}/5.modules.md +5 -5
- package/2.guide/{1.concepts → 2.concepts}/7.esm.md +22 -16
- package/2.guide/{1.concepts → 2.concepts}/8.typescript.md +12 -12
- package/2.guide/3.going-further/1.events.md +3 -3
- package/2.guide/3.going-further/1.experimental-features.md +334 -85
- package/2.guide/3.going-further/1.features.md +58 -11
- package/2.guide/3.going-further/1.internals.md +25 -25
- package/2.guide/3.going-further/10.runtime-config.md +12 -12
- package/2.guide/3.going-further/11.nightly-release-channel.md +1 -1
- package/2.guide/3.going-further/2.hooks.md +14 -14
- package/2.guide/3.going-further/3.modules.md +126 -108
- package/2.guide/3.going-further/4.kit.md +7 -7
- package/2.guide/3.going-further/6.nuxt-app.md +8 -8
- package/2.guide/3.going-further/7.layers.md +76 -59
- package/2.guide/3.going-further/9.debugging.md +2 -2
- package/2.guide/4.recipes/1.custom-routing.md +30 -30
- package/2.guide/4.recipes/2.vite-plugin.md +45 -4
- package/2.guide/4.recipes/3.custom-usefetch.md +13 -13
- package/2.guide/4.recipes/4.sessions-and-authentication.md +35 -21
- package/2.guide/5.best-practices/hydration.md +4 -4
- package/2.guide/5.best-practices/performance.md +17 -17
- package/3.api/1.components/1.client-only.md +6 -3
- package/3.api/1.components/1.nuxt-client-fallback.md +10 -7
- package/3.api/1.components/10.nuxt-picture.md +1 -1
- package/3.api/1.components/11.teleports.md +5 -2
- package/3.api/1.components/12.nuxt-route-announcer.md +9 -9
- package/3.api/1.components/13.nuxt-time.md +49 -18
- package/3.api/1.components/2.nuxt-page.md +6 -6
- package/3.api/1.components/3.nuxt-layout.md +15 -10
- package/3.api/1.components/4.nuxt-link.md +42 -22
- package/3.api/1.components/5.nuxt-loading-indicator.md +3 -3
- package/3.api/1.components/6.nuxt-error-boundary.md +12 -10
- package/3.api/2.composables/on-prehydrate.md +2 -2
- package/3.api/2.composables/use-app-config.md +1 -1
- package/3.api/2.composables/use-async-data.md +26 -22
- package/3.api/2.composables/use-cookie.md +29 -21
- package/3.api/2.composables/use-error.md +2 -2
- package/3.api/2.composables/use-fetch.md +62 -32
- package/3.api/2.composables/use-head-safe.md +7 -7
- package/3.api/2.composables/use-head.md +5 -5
- package/3.api/2.composables/use-hydration.md +6 -6
- package/3.api/2.composables/use-lazy-async-data.md +4 -4
- package/3.api/2.composables/use-lazy-fetch.md +4 -4
- package/3.api/2.composables/use-loading-indicator.md +12 -12
- package/3.api/2.composables/use-nuxt-app.md +22 -22
- package/3.api/2.composables/use-nuxt-data.md +8 -8
- package/3.api/2.composables/use-preview-mode.md +15 -18
- package/3.api/2.composables/use-request-event.md +1 -1
- package/3.api/2.composables/use-request-fetch.md +3 -3
- package/3.api/2.composables/use-request-header.md +1 -1
- package/3.api/2.composables/use-request-headers.md +4 -4
- package/3.api/2.composables/use-request-url.md +1 -1
- package/3.api/2.composables/use-response-header.md +9 -10
- package/3.api/2.composables/use-route-announcer.md +4 -4
- package/3.api/2.composables/use-route.md +1 -1
- package/3.api/2.composables/use-router.md +10 -8
- package/3.api/2.composables/use-runtime-config.md +11 -11
- package/3.api/2.composables/use-runtime-hook.md +2 -2
- package/3.api/2.composables/use-seo-meta.md +4 -4
- package/3.api/2.composables/use-server-seo-meta.md +6 -6
- package/3.api/2.composables/use-state.md +5 -5
- package/3.api/3.utils/$fetch.md +10 -8
- package/3.api/3.utils/abort-navigation.md +3 -3
- package/3.api/3.utils/add-route-middleware.md +5 -5
- package/3.api/3.utils/call-once.md +6 -6
- package/3.api/3.utils/clear-error.md +3 -3
- package/3.api/3.utils/clear-nuxt-data.md +3 -3
- package/3.api/3.utils/clear-nuxt-state.md +3 -3
- package/3.api/3.utils/create-error.md +2 -2
- package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
- package/3.api/3.utils/define-nuxt-component.md +5 -5
- package/3.api/3.utils/define-nuxt-plugin.md +13 -13
- package/3.api/3.utils/define-nuxt-route-middleware.md +5 -5
- package/3.api/3.utils/define-page-meta.md +23 -23
- package/3.api/3.utils/define-route-rules.md +7 -7
- package/3.api/3.utils/navigate-to.md +11 -11
- package/3.api/3.utils/prefetch-components.md +1 -1
- package/3.api/3.utils/preload-components.md +1 -1
- package/3.api/3.utils/preload-route-components.md +2 -2
- package/3.api/3.utils/prerender-routes.md +3 -3
- package/3.api/3.utils/refresh-cookie.md +4 -4
- package/3.api/3.utils/refresh-nuxt-data.md +12 -7
- package/3.api/3.utils/reload-nuxt-app.md +3 -3
- package/3.api/3.utils/set-page-layout.md +1 -1
- package/3.api/3.utils/set-response-status.md +3 -3
- package/3.api/3.utils/show-error.md +5 -5
- package/3.api/3.utils/update-app-config.md +4 -3
- package/3.api/4.commands/add.md +1 -1
- package/3.api/4.commands/analyze.md +2 -1
- package/3.api/4.commands/build.md +2 -1
- package/3.api/4.commands/dev.md +5 -4
- package/3.api/4.commands/generate.md +3 -2
- package/3.api/4.commands/init.md +3 -2
- package/3.api/4.commands/module.md +4 -4
- package/3.api/4.commands/prepare.md +7 -2
- package/3.api/4.commands/preview.md +5 -4
- package/3.api/4.commands/test.md +40 -0
- package/3.api/4.commands/typecheck.md +5 -3
- package/3.api/4.commands/upgrade.md +3 -3
- package/3.api/5.kit/1.modules.md +123 -37
- package/3.api/5.kit/10.runtime-config.md +1 -1
- package/3.api/5.kit/10.templates.md +8 -6
- package/3.api/5.kit/11.nitro.md +66 -62
- package/3.api/5.kit/12.resolving.md +2 -2
- package/3.api/5.kit/14.builder.md +61 -4
- package/3.api/5.kit/15.examples.md +5 -7
- package/3.api/5.kit/16.layers.md +26 -26
- package/3.api/5.kit/3.compatibility.md +14 -14
- package/3.api/5.kit/4.autoimports.md +13 -13
- package/3.api/5.kit/5.components.md +8 -7
- package/3.api/5.kit/6.context.md +3 -3
- package/3.api/5.kit/7.pages.md +7 -7
- package/3.api/5.kit/8.layout.md +2 -2
- package/3.api/5.kit/9.head.md +132 -0
- package/3.api/5.kit/9.plugins.md +5 -4
- package/3.api/6.advanced/1.hooks.md +5 -5
- package/3.api/6.advanced/2.import-meta.md +3 -3
- package/3.api/6.nuxt-config.md +365 -859
- package/3.api/index.md +7 -7
- package/5.community/2.getting-help.md +1 -1
- package/5.community/3.reporting-bugs.md +3 -3
- package/5.community/4.contribution.md +11 -11
- package/5.community/5.framework-contribution.md +4 -4
- package/5.community/6.roadmap.md +2 -2
- package/6.bridge/1.overview.md +13 -13
- package/6.bridge/10.configuration.md +2 -1
- package/6.bridge/2.typescript.md +3 -3
- package/6.bridge/3.bridge-composition-api.md +8 -8
- package/6.bridge/4.plugins-and-middleware.md +9 -9
- package/6.bridge/5.nuxt3-compatible-api.md +20 -17
- package/6.bridge/6.meta.md +20 -19
- package/6.bridge/7.runtime-config.md +1 -1
- package/6.bridge/8.nitro.md +3 -3
- package/6.bridge/9.vite.md +4 -4
- package/7.migration/1.overview.md +2 -2
- package/7.migration/10.bundling.md +1 -1
- package/7.migration/11.server.md +3 -3
- package/7.migration/2.configuration.md +23 -21
- package/7.migration/20.module-authors.md +7 -7
- package/7.migration/3.auto-imports.md +3 -3
- package/7.migration/4.meta.md +21 -18
- package/7.migration/5.plugins-and-middleware.md +8 -8
- package/7.migration/6.pages-and-layouts.md +28 -24
- package/7.migration/7.component-options.md +18 -18
- package/7.migration/8.runtime-config.md +7 -7
- package/package.json +1 -1
- package/2.guide/2.directory-structure/0.output.md +0 -18
- /package/2.guide/{1.concepts → 2.concepts}/.navigation.yml +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/9.code-style.md +0 -0
|
@@ -48,7 +48,7 @@ import { z } from 'zod'
|
|
|
48
48
|
|
|
49
49
|
const bodySchema = z.object({
|
|
50
50
|
email: z.string().email(),
|
|
51
|
-
password: z.string().min(8)
|
|
51
|
+
password: z.string().min(8),
|
|
52
52
|
})
|
|
53
53
|
|
|
54
54
|
export default defineEventHandler(async (event) => {
|
|
@@ -59,14 +59,14 @@ export default defineEventHandler(async (event) => {
|
|
|
59
59
|
// this server util is auto-imported by the auth-utils module
|
|
60
60
|
await setUserSession(event, {
|
|
61
61
|
user: {
|
|
62
|
-
name: 'John Doe'
|
|
63
|
-
}
|
|
62
|
+
name: 'John Doe',
|
|
63
|
+
},
|
|
64
64
|
})
|
|
65
65
|
return {}
|
|
66
66
|
}
|
|
67
67
|
throw createError({
|
|
68
68
|
statusCode: 401,
|
|
69
|
-
message: 'Bad credentials'
|
|
69
|
+
message: 'Bad credentials',
|
|
70
70
|
})
|
|
71
71
|
})
|
|
72
72
|
```
|
|
@@ -98,25 +98,37 @@ const credentials = reactive({
|
|
|
98
98
|
email: '',
|
|
99
99
|
password: '',
|
|
100
100
|
})
|
|
101
|
-
async function login() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
async function login () {
|
|
102
|
+
try {
|
|
103
|
+
await $fetch('/api/login', {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
body: credentials,
|
|
106
|
+
})
|
|
107
|
+
|
|
107
108
|
// Refresh the session on client-side and redirect to the home page
|
|
108
109
|
await refreshSession()
|
|
109
110
|
await navigateTo('/')
|
|
110
|
-
}
|
|
111
|
-
|
|
111
|
+
} catch {
|
|
112
|
+
alert('Bad credentials')
|
|
113
|
+
}
|
|
112
114
|
}
|
|
113
115
|
</script>
|
|
114
116
|
|
|
115
117
|
<template>
|
|
116
118
|
<form @submit.prevent="login">
|
|
117
|
-
<input
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
<input
|
|
120
|
+
v-model="credentials.email"
|
|
121
|
+
type="email"
|
|
122
|
+
placeholder="Email"
|
|
123
|
+
>
|
|
124
|
+
<input
|
|
125
|
+
v-model="credentials.password"
|
|
126
|
+
type="password"
|
|
127
|
+
placeholder="Password"
|
|
128
|
+
>
|
|
129
|
+
<button type="submit">
|
|
130
|
+
Login
|
|
131
|
+
</button>
|
|
120
132
|
</form>
|
|
121
133
|
</template>
|
|
122
134
|
```
|
|
@@ -138,12 +150,12 @@ export default defineEventHandler(async (event) => {
|
|
|
138
150
|
// TODO: Fetch some stats based on the user
|
|
139
151
|
|
|
140
152
|
return {}
|
|
141
|
-
})
|
|
153
|
+
})
|
|
142
154
|
```
|
|
143
155
|
|
|
144
156
|
## Protect App Routes
|
|
145
157
|
|
|
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.
|
|
158
|
+
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
159
|
|
|
148
160
|
`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
161
|
|
|
@@ -164,17 +176,17 @@ export default defineNuxtRouteMiddleware(() => {
|
|
|
164
176
|
|
|
165
177
|
Now that we have our app middleware to protect our routes, we can use it on our home page that display our authenticated user information. If the user is not authenticated, they will be redirected to the login page.
|
|
166
178
|
|
|
167
|
-
We'll use [`definePageMeta`](/docs/api/utils/define-page-meta) to apply the middleware to the route that we want to protect.
|
|
179
|
+
We'll use [`definePageMeta`](/docs/4.x/api/utils/define-page-meta) to apply the middleware to the route that we want to protect.
|
|
168
180
|
|
|
169
181
|
```vue [app/pages/index.vue]
|
|
170
182
|
<script setup lang="ts">
|
|
171
183
|
definePageMeta({
|
|
172
184
|
middleware: ['authenticated'],
|
|
173
185
|
})
|
|
174
|
-
|
|
186
|
+
|
|
175
187
|
const { user, clear: clearSession } = useUserSession()
|
|
176
188
|
|
|
177
|
-
async function logout() {
|
|
189
|
+
async function logout () {
|
|
178
190
|
await clearSession()
|
|
179
191
|
await navigateTo('/login')
|
|
180
192
|
}
|
|
@@ -183,7 +195,9 @@ async function logout() {
|
|
|
183
195
|
<template>
|
|
184
196
|
<div>
|
|
185
197
|
<h1>Welcome {{ user.name }}</h1>
|
|
186
|
-
<button @click="logout">
|
|
198
|
+
<button @click="logout">
|
|
199
|
+
Logout
|
|
200
|
+
</button>
|
|
187
201
|
</div>
|
|
188
202
|
</template>
|
|
189
203
|
```
|
|
@@ -47,7 +47,7 @@ const userTheme = localStorage.getItem('theme') || 'light'
|
|
|
47
47
|
</script>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
**Solution**: You can use [`useCookie`](/docs/api/composables/use-cookie):
|
|
50
|
+
**Solution**: You can use [`useCookie`](/docs/4.x/api/composables/use-cookie):
|
|
51
51
|
|
|
52
52
|
```html
|
|
53
53
|
<template>
|
|
@@ -144,7 +144,7 @@ const greeting = hour < 12 ? 'Good morning' : 'Good afternoon'
|
|
|
144
144
|
</script>
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
**Solution**: Use [`NuxtTime`](/docs/api/components/nuxt-time) component or handle it client-side:
|
|
147
|
+
**Solution**: Use [`NuxtTime`](/docs/4.x/api/components/nuxt-time) component or handle it client-side:
|
|
148
148
|
|
|
149
149
|
```html
|
|
150
150
|
<template>
|
|
@@ -178,8 +178,8 @@ onMounted(() => {
|
|
|
178
178
|
|
|
179
179
|
## In summary
|
|
180
180
|
|
|
181
|
-
1. **Use SSR-friendly composables**: [`useFetch`](/docs/api/composables/use-fetch), [`useAsyncData`](/docs/api/composables/use-async-data), [`useState`](/docs/api/composables/use-state)
|
|
182
|
-
2. **Wrap client-only code**: Use [`ClientOnly`](/docs/api/components/client-only) component for browser-specific content
|
|
181
|
+
1. **Use SSR-friendly composables**: [`useFetch`](/docs/4.x/api/composables/use-fetch), [`useAsyncData`](/docs/4.x/api/composables/use-async-data), [`useState`](/docs/4.x/api/composables/use-state)
|
|
182
|
+
2. **Wrap client-only code**: Use [`ClientOnly`](/docs/4.x/api/components/client-only) component for browser-specific content
|
|
183
183
|
3. **Consistent data sources**: Ensure server and client uses the same data
|
|
184
184
|
4. **Avoid side effects in setup**: Move browser-dependent code to `onMounted`
|
|
185
185
|
|
|
@@ -12,7 +12,7 @@ Nuxt offers several built-in features that help you optimize performance of your
|
|
|
12
12
|
|
|
13
13
|
### Links
|
|
14
14
|
|
|
15
|
-
[`<NuxtLink>`](/docs/api/components/nuxt-link) is a drop-in replacement for both Vue Router's `<RouterLink>` component and HTML's `<a>` tag. It intelligently determines whether the link is internal or external and renders it accordingly with available optimizations (prefetching, default attributes, etc.)
|
|
15
|
+
[`<NuxtLink>`](/docs/4.x/api/components/nuxt-link) is a drop-in replacement for both Vue Router's `<RouterLink>` component and HTML's `<a>` tag. It intelligently determines whether the link is internal or external and renders it accordingly with available optimizations (prefetching, default attributes, etc.)
|
|
16
16
|
|
|
17
17
|
```html
|
|
18
18
|
<template>
|
|
@@ -34,12 +34,12 @@ export default defineNuxtConfig({
|
|
|
34
34
|
nuxtLink: {
|
|
35
35
|
prefetchOn: 'interaction',
|
|
36
36
|
},
|
|
37
|
-
}
|
|
38
|
-
}
|
|
37
|
+
},
|
|
38
|
+
},
|
|
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
|
|
|
@@ -51,24 +51,24 @@ Hybrid rendering allows different caching rules per route using Route Rules and
|
|
|
51
51
|
export default defineNuxtConfig({
|
|
52
52
|
routeRules: {
|
|
53
53
|
'/': {
|
|
54
|
-
prerender: true
|
|
54
|
+
prerender: true,
|
|
55
55
|
},
|
|
56
56
|
'/products/**': {
|
|
57
|
-
swr: 3600
|
|
57
|
+
swr: 3600,
|
|
58
58
|
},
|
|
59
59
|
'/blog': {
|
|
60
|
-
isr: 3600
|
|
60
|
+
isr: 3600,
|
|
61
61
|
},
|
|
62
62
|
'/admin/**': {
|
|
63
|
-
ssr: false
|
|
63
|
+
ssr: false,
|
|
64
64
|
},
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
66
|
})
|
|
67
67
|
```
|
|
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
|
-
To avoid fetching same data twice (once on the server and once on client) Nuxt provides [`useFetch`](/docs/api/composables/use-fetch) and [`useAsyncData`](/docs/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.
|
|
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
|
|
|
@@ -126,7 +126,7 @@ In Nuxt we can use [Nuxt Image](https://image.nuxt.com/) module that is a plug-a
|
|
|
126
126
|
|
|
127
127
|
:video-accordion{title="Watch the video by LearnVue about Nuxt Image" videoId="_UBff2eqGY0"}
|
|
128
128
|
|
|
129
|
-
[`<NuxtImg>`](/docs/api/components/nuxt-img) is a drop-in replacement for the native `<img>` tag that comes with following enhancements:
|
|
129
|
+
[`<NuxtImg>`](/docs/4.x/api/components/nuxt-img) is a drop-in replacement for the native `<img>` tag that comes with following enhancements:
|
|
130
130
|
|
|
131
131
|
* Uses built-in provider to optimize local and remote images
|
|
132
132
|
* Converts `src` to provider optimized URLs with modern formats such as WebP or Avif
|
|
@@ -193,7 +193,7 @@ Nuxt Scripts provides an abstraction layer on top of third-party scripts, provid
|
|
|
193
193
|
|
|
194
194
|
```ts
|
|
195
195
|
const { onLoaded, proxy } = useScriptGoogleAnalytics(
|
|
196
|
-
{
|
|
196
|
+
{
|
|
197
197
|
id: 'G-1234567',
|
|
198
198
|
scriptOptions: {
|
|
199
199
|
trigger: 'manual',
|
|
@@ -216,7 +216,7 @@ To improve performance, we need to first know how to measure it, starting with m
|
|
|
216
216
|
|
|
217
217
|
### Nuxi Analyze
|
|
218
218
|
|
|
219
|
-
[This](/docs/api/commands/analyze) command of `nuxi` allows to analyze the production bundle or your Nuxt application. It leverages `vite-bundle-visualizer` (similar to `webpack-bundle-analyzer`) to generate a visual representation of your application's bundle, making it easier to identify which components take up the most space.
|
|
219
|
+
[This](/docs/4.x/api/commands/analyze) command of `nuxi` allows to analyze the production bundle or your Nuxt application. It leverages `vite-bundle-visualizer` (similar to `webpack-bundle-analyzer`) to generate a visual representation of your application's bundle, making it easier to identify which components take up the most space.
|
|
220
220
|
|
|
221
221
|
When you see a large block in the visualization, it often signals an opportunity for optimization—whether by splitting it into smaller parts, implementing lazy loading, or replacing it with a more efficient alternative, especially for third-party libraries.
|
|
222
222
|
|
|
@@ -24,7 +24,10 @@ The content of the default slot will be tree-shaken out of the server build. (Th
|
|
|
24
24
|
<div>
|
|
25
25
|
<Sidebar />
|
|
26
26
|
<!-- The <Comment> component will only be rendered on client-side -->
|
|
27
|
-
<ClientOnly
|
|
27
|
+
<ClientOnly
|
|
28
|
+
fallback-tag="span"
|
|
29
|
+
fallback="Loading comments..."
|
|
30
|
+
>
|
|
28
31
|
<Comment />
|
|
29
32
|
</ClientOnly>
|
|
30
33
|
</div>
|
|
@@ -40,7 +43,7 @@ The content of the default slot will be tree-shaken out of the server build. (Th
|
|
|
40
43
|
<div>
|
|
41
44
|
<Sidebar />
|
|
42
45
|
<!-- This renders the "span" element on the server side -->
|
|
43
|
-
<ClientOnly
|
|
46
|
+
<ClientOnly fallback-tag="span">
|
|
44
47
|
<!-- this component will only be rendered on client side -->
|
|
45
48
|
<Comments />
|
|
46
49
|
<template #fallback>
|
|
@@ -64,7 +67,7 @@ const nuxtWelcomeRef = useTemplateRef('nuxtWelcomeRef')
|
|
|
64
67
|
|
|
65
68
|
// The watch will be triggered when the component is available
|
|
66
69
|
watch(nuxtWelcomeRef, () => {
|
|
67
|
-
|
|
70
|
+
console.log('<NuxtWelcome /> mounted')
|
|
68
71
|
}, { once: true })
|
|
69
72
|
</script>
|
|
70
73
|
|
|
@@ -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
|
|
|
@@ -55,12 +55,15 @@ This component is experimental and in order to use it you must enable the `exper
|
|
|
55
55
|
- **default**: `false`
|
|
56
56
|
|
|
57
57
|
```vue
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
<template>
|
|
59
|
+
<!-- render <span>Hello world</span> server-side if the default slot fails to render -->
|
|
60
|
+
<NuxtClientFallback
|
|
61
|
+
fallback-tag="span"
|
|
62
|
+
fallback="Hello world"
|
|
63
|
+
>
|
|
64
|
+
<BrokeInSSR />
|
|
65
|
+
</NuxtClientFallback>
|
|
66
|
+
</template>
|
|
64
67
|
```
|
|
65
68
|
|
|
66
69
|
## Slots
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
`<NuxtPicture>` is a drop-in replacement for the native `<picture>` tag.
|
|
12
12
|
|
|
13
|
-
Usage of `<NuxtPicture>` is almost identical to [`<NuxtImg>`](/docs/api/components/nuxt-img) but it also allows serving modern formats like `webp` when possible.
|
|
13
|
+
Usage of `<NuxtPicture>` is almost identical to [`<NuxtImg>`](/docs/4.x/api/components/nuxt-img) but it also allows serving modern formats like `webp` when possible.
|
|
14
14
|
|
|
15
15
|
Learn more about the [`<picture>` tag on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture).
|
|
16
16
|
|
|
@@ -15,7 +15,10 @@ The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport.htm
|
|
|
15
15
|
Open Modal
|
|
16
16
|
</button>
|
|
17
17
|
<Teleport to="#teleports">
|
|
18
|
-
<div
|
|
18
|
+
<div
|
|
19
|
+
v-if="open"
|
|
20
|
+
class="modal"
|
|
21
|
+
>
|
|
19
22
|
<p>Hello from the modal!</p>
|
|
20
23
|
<button @click="open = false">
|
|
21
24
|
Close
|
|
@@ -37,4 +40,4 @@ The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport.htm
|
|
|
37
40
|
</template>
|
|
38
41
|
```
|
|
39
42
|
|
|
40
|
-
:link-example{to="/docs/examples/advanced/teleport"}
|
|
43
|
+
:link-example{to="/docs/4.x/examples/advanced/teleport"}
|
|
@@ -16,7 +16,7 @@ This component is available in Nuxt v3.12+.
|
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
Add `<NuxtRouteAnnouncer/>` in your [`app.vue`](/docs/guide/directory-structure/app) or [`app/layouts/`](/docs/guide/directory-structure/app/layouts) to enhance accessibility by informing assistive technologies about page title changes. This ensures that navigational changes are announced to users relying on screen readers.
|
|
19
|
+
Add `<NuxtRouteAnnouncer/>` in your [`app.vue`](/docs/4.x/guide/directory-structure/app) or [`app/layouts/`](/docs/4.x/guide/directory-structure/app/layouts) to enhance accessibility by informing assistive technologies about page title changes. This ensures that navigational changes are announced to users relying on screen readers.
|
|
20
20
|
|
|
21
21
|
```vue [app/app.vue]
|
|
22
22
|
<template>
|
|
@@ -32,13 +32,13 @@ Add `<NuxtRouteAnnouncer/>` in your [`app.vue`](/docs/guide/directory-structure/
|
|
|
32
32
|
You can pass custom HTML or components through the route announcer's default slot.
|
|
33
33
|
|
|
34
34
|
```vue
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
<template>
|
|
36
|
+
<NuxtRouteAnnouncer>
|
|
37
|
+
<template #default="{ message }">
|
|
38
|
+
<p>{{ message }} was loaded.</p>
|
|
39
|
+
</template>
|
|
40
|
+
</NuxtRouteAnnouncer>
|
|
41
|
+
</template>
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
## Props
|
|
@@ -52,5 +52,5 @@ To achieve full customization, you can implement your own one based on [its sour
|
|
|
52
52
|
::
|
|
53
53
|
|
|
54
54
|
::callout
|
|
55
|
-
You can hook into the underlying announcer instance using [the `useRouteAnnouncer` composable](/docs/api/composables/use-route-announcer), which allows you to set a custom announcement message.
|
|
55
|
+
You can hook into the underlying announcer instance using [the `useRouteAnnouncer` composable](/docs/4.x/api/composables/use-route-announcer), which allows you to set a custom announcement message.
|
|
56
56
|
::
|
|
@@ -56,7 +56,10 @@ The [BCP 47 language tag](https://datatracker.ietf.org/doc/html/rfc5646) for for
|
|
|
56
56
|
|
|
57
57
|
```vue
|
|
58
58
|
<template>
|
|
59
|
-
<NuxtTime
|
|
59
|
+
<NuxtTime
|
|
60
|
+
:datetime="Date.now()"
|
|
61
|
+
locale="fr-FR"
|
|
62
|
+
/>
|
|
60
63
|
</template>
|
|
61
64
|
```
|
|
62
65
|
|
|
@@ -66,8 +69,8 @@ The component accepts any property from the [Intl.DateTimeFormat](https://develo
|
|
|
66
69
|
|
|
67
70
|
```vue
|
|
68
71
|
<template>
|
|
69
|
-
<NuxtTime
|
|
70
|
-
:datetime="Date.now()"
|
|
72
|
+
<NuxtTime
|
|
73
|
+
:datetime="Date.now()"
|
|
71
74
|
year="numeric"
|
|
72
75
|
month="long"
|
|
73
76
|
day="numeric"
|
|
@@ -90,7 +93,10 @@ Enables relative time formatting using the Intl.RelativeTimeFormat API:
|
|
|
90
93
|
```vue
|
|
91
94
|
<template>
|
|
92
95
|
<!-- Shows something like "5 minutes ago" -->
|
|
93
|
-
<NuxtTime
|
|
96
|
+
<NuxtTime
|
|
97
|
+
:datetime="Date.now() - 5 * 60 * 1000"
|
|
98
|
+
relative
|
|
99
|
+
/>
|
|
94
100
|
</template>
|
|
95
101
|
```
|
|
96
102
|
|
|
@@ -98,13 +104,17 @@ Enables relative time formatting using the Intl.RelativeTimeFormat API:
|
|
|
98
104
|
|
|
99
105
|
When `relative` is set to `true`, the component also accepts properties from [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat):
|
|
100
106
|
|
|
107
|
+
::warning
|
|
108
|
+
Due to `style` being a reserved prop, `relativeStyle` prop is used instead.
|
|
109
|
+
::
|
|
110
|
+
|
|
101
111
|
```vue
|
|
102
112
|
<template>
|
|
103
|
-
<NuxtTime
|
|
104
|
-
:datetime="Date.now() - 3 * 24 * 60 * 60 * 1000"
|
|
105
|
-
relative
|
|
113
|
+
<NuxtTime
|
|
114
|
+
:datetime="Date.now() - 3 * 24 * 60 * 60 * 1000"
|
|
115
|
+
relative
|
|
106
116
|
numeric="auto"
|
|
107
|
-
style="long"
|
|
117
|
+
relative-style="long"
|
|
108
118
|
/>
|
|
109
119
|
</template>
|
|
110
120
|
```
|
|
@@ -125,8 +135,8 @@ This would output something like: "3 days ago" or "last Friday" depending on the
|
|
|
125
135
|
|
|
126
136
|
```vue
|
|
127
137
|
<template>
|
|
128
|
-
<NuxtTime
|
|
129
|
-
:datetime="Date.now()"
|
|
138
|
+
<NuxtTime
|
|
139
|
+
:datetime="Date.now()"
|
|
130
140
|
weekday="long"
|
|
131
141
|
year="numeric"
|
|
132
142
|
month="short"
|
|
@@ -134,7 +144,7 @@ This would output something like: "3 days ago" or "last Friday" depending on the
|
|
|
134
144
|
hour="numeric"
|
|
135
145
|
minute="numeric"
|
|
136
146
|
second="numeric"
|
|
137
|
-
|
|
147
|
+
time-zone-name="short"
|
|
138
148
|
/>
|
|
139
149
|
</template>
|
|
140
150
|
```
|
|
@@ -145,15 +155,24 @@ This would output something like: "3 days ago" or "last Friday" depending on the
|
|
|
145
155
|
<template>
|
|
146
156
|
<div>
|
|
147
157
|
<p>
|
|
148
|
-
<NuxtTime
|
|
158
|
+
<NuxtTime
|
|
159
|
+
:datetime="Date.now() - 30 * 1000"
|
|
160
|
+
relative
|
|
161
|
+
/>
|
|
149
162
|
<!-- 30 seconds ago -->
|
|
150
163
|
</p>
|
|
151
|
-
<p>
|
|
152
|
-
<NuxtTime
|
|
164
|
+
<p>
|
|
165
|
+
<NuxtTime
|
|
166
|
+
:datetime="Date.now() - 45 * 60 * 1000"
|
|
167
|
+
relative
|
|
168
|
+
/>
|
|
153
169
|
<!-- 45 minutes ago -->
|
|
154
170
|
</p>
|
|
155
171
|
<p>
|
|
156
|
-
<NuxtTime
|
|
172
|
+
<NuxtTime
|
|
173
|
+
:datetime="Date.now() + 2 * 24 * 60 * 60 * 1000"
|
|
174
|
+
relative
|
|
175
|
+
/>
|
|
157
176
|
<!-- in 2 days -->
|
|
158
177
|
</p>
|
|
159
178
|
</div>
|
|
@@ -165,9 +184,21 @@ This would output something like: "3 days ago" or "last Friday" depending on the
|
|
|
165
184
|
```vue
|
|
166
185
|
<template>
|
|
167
186
|
<div>
|
|
168
|
-
<NuxtTime
|
|
169
|
-
|
|
170
|
-
|
|
187
|
+
<NuxtTime
|
|
188
|
+
:datetime="Date.now()"
|
|
189
|
+
locale="en-US"
|
|
190
|
+
weekday="long"
|
|
191
|
+
/>
|
|
192
|
+
<NuxtTime
|
|
193
|
+
:datetime="Date.now()"
|
|
194
|
+
locale="fr-FR"
|
|
195
|
+
weekday="long"
|
|
196
|
+
/>
|
|
197
|
+
<NuxtTime
|
|
198
|
+
:datetime="Date.now()"
|
|
199
|
+
locale="ja-JP"
|
|
200
|
+
weekday="long"
|
|
201
|
+
/>
|
|
171
202
|
</div>
|
|
172
203
|
</template>
|
|
173
204
|
```
|
|
@@ -8,7 +8,7 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
`<NuxtPage>` is a built-in component that comes with Nuxt. It lets you display top-level or nested pages located in the [`app/pages/`](/docs/guide/directory-structure/app/pages) directory.
|
|
11
|
+
`<NuxtPage>` is a built-in component that comes with Nuxt. It lets you display top-level or nested pages located in the [`app/pages/`](/docs/4.x/guide/directory-structure/app/pages) directory.
|
|
12
12
|
|
|
13
13
|
::note
|
|
14
14
|
`<NuxtPage>` is a wrapper around [`<RouterView>`](https://router.vuejs.org/api/interfaces/RouterViewProps.html#interface-routerviewprops) from Vue Router. It should be used instead of `<RouterView>` because the former takes additional care of internal states. Otherwise, `useRoute()` may return incorrect paths.
|
|
@@ -18,7 +18,7 @@ links:
|
|
|
18
18
|
|
|
19
19
|
```vue
|
|
20
20
|
<template>
|
|
21
|
-
<RouterView
|
|
21
|
+
<RouterView v-slot="{ Component }">
|
|
22
22
|
<!-- Optional, when using transitions -->
|
|
23
23
|
<Transition>
|
|
24
24
|
<!-- Optional, when using keep-alive -->
|
|
@@ -79,17 +79,17 @@ You can also use a dynamic key based on the current route:
|
|
|
79
79
|
Don't use `$route` object here as it can cause problems with how `<NuxtPage>` renders pages with `<Suspense>`.
|
|
80
80
|
::
|
|
81
81
|
|
|
82
|
-
Alternatively, `pageKey` can be passed as a `key` value via [`definePageMeta`](/docs/api/utils/define-page-meta) from the `<script>` section of your Vue component in the `/pages` directory.
|
|
82
|
+
Alternatively, `pageKey` can be passed as a `key` value via [`definePageMeta`](/docs/4.x/api/utils/define-page-meta) from the `<script>` section of your Vue component in the `/pages` directory.
|
|
83
83
|
|
|
84
84
|
```vue [app/pages/my-page.vue]
|
|
85
85
|
<script setup lang="ts">
|
|
86
86
|
definePageMeta({
|
|
87
|
-
key: route => route.fullPath
|
|
87
|
+
key: route => route.fullPath,
|
|
88
88
|
})
|
|
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,11 +18,11 @@ 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
|
|
|
25
|
-
- `name`: Specify a layout name to be rendered, can be a string, reactive reference or a computed property. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/guide/directory-structure/app/layouts) directory.
|
|
25
|
+
- `name`: Specify a layout name to be rendered, can be a string, reactive reference or a computed property. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/4.x/guide/directory-structure/app/layouts) directory.
|
|
26
26
|
- **type**: `string`
|
|
27
27
|
- **default**: `default`
|
|
28
28
|
|
|
@@ -51,11 +51,11 @@ 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
|
|
|
58
|
-
- `fallback`: If an invalid layout is passed to the `name` prop, no layout will be rendered. Specify a `fallback` layout to be rendered in this scenario. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/guide/directory-structure/app/layouts) directory.
|
|
58
|
+
- `fallback`: If an invalid layout is passed to the `name` prop, no layout will be rendered. Specify a `fallback` layout to be rendered in this scenario. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/4.x/guide/directory-structure/app/layouts) directory.
|
|
59
59
|
- **type**: `string`
|
|
60
60
|
- **default**: `null`
|
|
61
61
|
|
|
@@ -66,8 +66,11 @@ Read more about dynamic layouts.
|
|
|
66
66
|
```vue [app/pages/some-page.vue]
|
|
67
67
|
<template>
|
|
68
68
|
<div>
|
|
69
|
-
<NuxtLayout
|
|
70
|
-
|
|
69
|
+
<NuxtLayout
|
|
70
|
+
name="custom"
|
|
71
|
+
title="I am a custom layout"
|
|
72
|
+
>
|
|
73
|
+
<!-- ... -->
|
|
71
74
|
</NuxtLayout>
|
|
72
75
|
</div>
|
|
73
76
|
</template>
|
|
@@ -93,7 +96,9 @@ console.log(layoutCustomProps.title) // I am a custom layout
|
|
|
93
96
|
<template>
|
|
94
97
|
<div>
|
|
95
98
|
<NuxtLayout name="custom">
|
|
96
|
-
<template #header>
|
|
99
|
+
<template #header>
|
|
100
|
+
Some header template content.
|
|
101
|
+
</template>
|
|
97
102
|
</NuxtLayout>
|
|
98
103
|
</div>
|
|
99
104
|
</template>
|
|
@@ -111,7 +116,7 @@ console.log(layoutCustomProps.title) // I am a custom layout
|
|
|
111
116
|
|
|
112
117
|
::
|
|
113
118
|
|
|
114
|
-
:read-more{to="/docs/getting-started/transitions"}
|
|
119
|
+
:read-more{to="/docs/4.x/getting-started/transitions"}
|
|
115
120
|
|
|
116
121
|
## Layout's Ref
|
|
117
122
|
|
|
@@ -139,7 +144,7 @@ function logFoo () {
|
|
|
139
144
|
<script setup lang="ts">
|
|
140
145
|
const foo = () => console.log('foo')
|
|
141
146
|
defineExpose({
|
|
142
|
-
foo
|
|
147
|
+
foo,
|
|
143
148
|
})
|
|
144
149
|
</script>
|
|
145
150
|
|
|
@@ -153,4 +158,4 @@ defineExpose({
|
|
|
153
158
|
|
|
154
159
|
::
|
|
155
160
|
|
|
156
|
-
:read-more{to="/docs/guide/directory-structure/app/layouts"}
|
|
161
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/layouts"}
|