@nuxt/docs-nightly 4.1.1-29282087.9ed08339 → 4.1.1-29283054.32d56553
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 +1 -1
- package/1.getting-started/03.configuration.md +2 -2
- package/1.getting-started/04.views.md +15 -15
- package/1.getting-started/05.assets.md +6 -6
- package/1.getting-started/06.styling.md +8 -8
- package/1.getting-started/07.routing.md +7 -7
- package/1.getting-started/08.seo-meta.md +9 -9
- package/1.getting-started/09.transitions.md +15 -15
- package/1.getting-started/10.data-fetching.md +9 -9
- package/1.getting-started/11.state-management.md +7 -7
- package/1.getting-started/12.error-handling.md +1 -1
- package/1.getting-started/14.layers.md +2 -2
- package/1.getting-started/15.prerendering.md +2 -2
- package/1.getting-started/17.testing.md +1 -1
- package/1.getting-started/18.upgrade.md +7 -7
- package/2.guide/1.concepts/1.auto-imports.md +6 -6
- package/2.guide/1.concepts/10.nuxt-lifecycle.md +6 -6
- package/2.guide/1.concepts/2.vuejs-development.md +3 -3
- package/2.guide/1.concepts/3.rendering.md +2 -2
- package/2.guide/1.concepts/8.typescript.md +1 -1
- package/2.guide/2.directory-structure/1.app/1.components.md +18 -18
- package/2.guide/2.directory-structure/1.app/1.composables.md +11 -11
- package/2.guide/2.directory-structure/1.app/1.layouts.md +7 -7
- package/2.guide/2.directory-structure/1.app/1.middleware.md +3 -3
- package/2.guide/2.directory-structure/1.app/1.pages.md +15 -15
- package/2.guide/2.directory-structure/1.app/1.plugins.md +7 -7
- package/2.guide/2.directory-structure/1.app/1.utils.md +3 -3
- package/2.guide/2.directory-structure/1.app/3.app-config.md +2 -2
- package/2.guide/2.directory-structure/1.app/3.app.md +12 -12
- package/2.guide/2.directory-structure/1.content.md +2 -2
- package/2.guide/2.directory-structure/1.public.md +1 -1
- package/2.guide/2.directory-structure/1.server.md +3 -3
- package/2.guide/2.directory-structure/1.shared.md +3 -3
- package/2.guide/3.going-further/1.experimental-features.md +5 -5
- package/2.guide/3.going-further/10.runtime-config.md +2 -2
- package/2.guide/3.going-further/2.hooks.md +1 -1
- package/2.guide/3.going-further/6.nuxt-app.md +2 -2
- package/2.guide/3.going-further/7.layers.md +7 -7
- package/2.guide/4.recipes/1.custom-routing.md +1 -1
- package/2.guide/4.recipes/2.vite-plugin.md +1 -1
- package/2.guide/4.recipes/3.custom-usefetch.md +4 -4
- package/2.guide/4.recipes/4.sessions-and-authentication.md +4 -4
- package/2.guide/5.best-practices/performance.md +2 -2
- package/3.api/1.components/1.client-only.md +2 -2
- package/3.api/1.components/1.dev-only.md +1 -1
- package/3.api/1.components/1.nuxt-client-fallback.md +1 -1
- package/3.api/1.components/12.nuxt-route-announcer.md +2 -2
- package/3.api/1.components/2.nuxt-page.md +8 -8
- package/3.api/1.components/3.nuxt-layout.md +13 -13
- package/3.api/1.components/4.nuxt-link.md +9 -9
- package/3.api/1.components/5.nuxt-loading-indicator.md +2 -2
- package/3.api/1.components/7.nuxt-welcome.md +1 -1
- package/3.api/2.composables/on-prehydrate.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-fetch.md +2 -2
- package/3.api/2.composables/use-lazy-async-data.md +1 -1
- package/3.api/2.composables/use-lazy-fetch.md +1 -1
- package/3.api/2.composables/use-nuxt-app.md +7 -7
- package/3.api/2.composables/use-nuxt-data.md +4 -4
- package/3.api/2.composables/use-preview-mode.md +1 -1
- package/3.api/2.composables/use-request-fetch.md +1 -1
- package/3.api/2.composables/use-request-header.md +1 -1
- package/3.api/2.composables/use-request-headers.md +1 -1
- package/3.api/2.composables/use-request-url.md +1 -1
- package/3.api/2.composables/use-response-header.md +3 -3
- package/3.api/2.composables/use-route-announcer.md +1 -1
- package/3.api/2.composables/use-router.md +5 -5
- package/3.api/2.composables/use-runtime-config.md +1 -1
- package/3.api/2.composables/use-seo-meta.md +3 -3
- package/3.api/2.composables/use-server-seo-meta.md +1 -1
- package/3.api/3.utils/$fetch.md +4 -4
- package/3.api/3.utils/abort-navigation.md +4 -4
- package/3.api/3.utils/add-route-middleware.md +5 -5
- package/3.api/3.utils/call-once.md +2 -2
- package/3.api/3.utils/create-error.md +1 -1
- package/3.api/3.utils/define-nuxt-component.md +2 -2
- package/3.api/3.utils/define-nuxt-route-middleware.md +3 -3
- package/3.api/3.utils/define-page-meta.md +12 -12
- package/3.api/3.utils/define-route-rules.md +1 -1
- package/3.api/3.utils/navigate-to.md +1 -1
- package/3.api/3.utils/on-nuxt-ready.md +1 -1
- package/3.api/3.utils/refresh-cookie.md +1 -1
- package/3.api/3.utils/refresh-nuxt-data.md +2 -2
- package/3.api/3.utils/set-page-layout.md +1 -1
- package/3.api/4.commands/add.md +7 -7
- package/3.api/5.kit/7.pages.md +1 -1
- package/3.api/5.kit/8.layout.md +1 -1
- package/3.api/5.kit/9.plugins.md +1 -1
- package/3.api/6.nuxt-config.md +11 -16
- package/6.bridge/4.plugins-and-middleware.md +3 -3
- package/6.bridge/6.meta.md +1 -1
- package/7.migration/2.configuration.md +2 -2
- package/7.migration/3.auto-imports.md +1 -1
- package/7.migration/5.plugins-and-middleware.md +2 -2
- package/7.migration/6.pages-and-layouts.md +8 -8
- package/7.migration/7.component-options.md +4 -4
- package/7.migration/8.runtime-config.md +1 -1
- package/package.json +1 -1
|
@@ -25,14 +25,14 @@ Consider creating an `app.vue` file and including any logic that needs to run on
|
|
|
25
25
|
|
|
26
26
|
If you are using layouts in your app for multiple pages, there is only a slight change required.
|
|
27
27
|
|
|
28
|
-
In Nuxt 2, the `<Nuxt>` component is used within a layout to render the current page. In Nuxt 3, layouts use slots instead, so you will have to replace that component with a `<slot />`. This also allows advanced use cases with named and scoped slots. [Read more about layouts](/docs/guide/directory-structure/layouts).
|
|
28
|
+
In Nuxt 2, the `<Nuxt>` component is used within a layout to render the current page. In Nuxt 3, layouts use slots instead, so you will have to replace that component with a `<slot />`. This also allows advanced use cases with named and scoped slots. [Read more about layouts](/docs/guide/directory-structure/app/layouts).
|
|
29
29
|
|
|
30
|
-
You will also need to change how you define the layout used by a page using the `definePageMeta` compiler macro. Layouts will be kebab-cased. So `layouts/customLayout.vue` becomes `custom-layout` when referenced in your page.
|
|
30
|
+
You will also need to change how you define the layout used by a page using the `definePageMeta` compiler macro. Layouts will be kebab-cased. So `app/layouts/customLayout.vue` becomes `custom-layout` when referenced in your page.
|
|
31
31
|
|
|
32
32
|
### Migration
|
|
33
33
|
|
|
34
34
|
1. Replace `<Nuxt />` with `<slot />`
|
|
35
|
-
```diff [layouts/custom.vue]
|
|
35
|
+
```diff [app/layouts/custom.vue]
|
|
36
36
|
<template>
|
|
37
37
|
<div id="app-layout">
|
|
38
38
|
<main>
|
|
@@ -43,7 +43,7 @@ You will also need to change how you define the layout used by a page using the
|
|
|
43
43
|
</template>
|
|
44
44
|
```
|
|
45
45
|
2. Use [`definePageMeta`](/docs/api/utils/define-page-meta) to select the layout used by your page.
|
|
46
|
-
```diff [pages/index.vue]
|
|
46
|
+
```diff [app/pages/index.vue]
|
|
47
47
|
+ <script setup>
|
|
48
48
|
+ definePageMeta({
|
|
49
49
|
+ layout: 'custom'
|
|
@@ -54,7 +54,7 @@ You will also need to change how you define the layout used by a page using the
|
|
|
54
54
|
- }
|
|
55
55
|
</script>
|
|
56
56
|
```
|
|
57
|
-
3. Move `~/layouts/_error.vue` to `~/error.vue`. See [the error handling docs](/docs/getting-started/error-handling). If you want to ensure that this page uses a layout, you can use [`<NuxtLayout>`](/docs/guide/directory-structure/layouts) directly within `error.vue`:
|
|
57
|
+
3. Move `~/layouts/_error.vue` to `~/error.vue`. See [the error handling docs](/docs/getting-started/error-handling). If you want to ensure that this page uses a layout, you can use [`<NuxtLayout>`](/docs/guide/directory-structure/app/layouts) directly within `error.vue`:
|
|
58
58
|
```vue [error.vue]
|
|
59
59
|
<template>
|
|
60
60
|
<div>
|
|
@@ -67,11 +67,11 @@ You will also need to change how you define the layout used by a page using the
|
|
|
67
67
|
|
|
68
68
|
## Pages
|
|
69
69
|
|
|
70
|
-
Nuxt 3 ships with an optional `vue-router` integration triggered by the existence of a [`pages/`](/docs/guide/directory-structure/pages) directory in your source directory. If you only have a single page, you may consider instead moving it to `app.vue` for a lighter build.
|
|
70
|
+
Nuxt 3 ships with an optional `vue-router` integration triggered by the existence of a [`app/pages/`](/docs/guide/directory-structure/app/pages) directory in your source directory. If you only have a single page, you may consider instead moving it to `app.vue` for a lighter build.
|
|
71
71
|
|
|
72
72
|
### Dynamic Routes
|
|
73
73
|
|
|
74
|
-
The format for defining dynamic routes in Nuxt 3 is slightly different from Nuxt 2, so you may need to rename some of the files within `pages/`.
|
|
74
|
+
The format for defining dynamic routes in Nuxt 3 is slightly different from Nuxt 2, so you may need to rename some of the files within `app/pages/`.
|
|
75
75
|
|
|
76
76
|
1. Where you previously used `_id` to define a dynamic route parameter you now use `[id]`.
|
|
77
77
|
2. Where you previously used `_.vue` to define a catch-all route, you now use `[...slug].vue`.
|
|
@@ -84,7 +84,7 @@ In Nuxt 2, you will have defined any nested routes (with parent and child compon
|
|
|
84
84
|
|
|
85
85
|
If you were passing a custom page key or keep-alive props to `<Nuxt>`, you will now use `definePageMeta` to set these options.
|
|
86
86
|
|
|
87
|
-
:read-more{to="/docs/guide/directory-structure/pages#special-metadata"}
|
|
87
|
+
:read-more{to="/docs/guide/directory-structure/app/pages#special-metadata"}
|
|
88
88
|
|
|
89
89
|
### Page and Layout Transitions
|
|
90
90
|
|
|
@@ -73,7 +73,7 @@ Despite the names, [`useFetch`](/docs/api/composables/use-fetch) is not a direct
|
|
|
73
73
|
|
|
74
74
|
You can now define a key within the [`definePageMeta`](/docs/api/utils/define-page-meta) compiler macro.
|
|
75
75
|
|
|
76
|
-
```diff [pages/index.vue]
|
|
76
|
+
```diff [app/pages/index.vue]
|
|
77
77
|
- <script>
|
|
78
78
|
- export default {
|
|
79
79
|
- key: 'index'
|
|
@@ -106,7 +106,7 @@ This feature is not yet supported in Nuxt 3.
|
|
|
106
106
|
This feature is not yet supported in Nuxt 3. If you want to overwrite the default scroll behavior of `vue-router`, you can do so in an `~/router.options.ts` (see [docs](/docs/guide/recipes/custom-routing#router-options)) for more info.
|
|
107
107
|
Similar to `key`, specify it within the [`definePageMeta`](/docs/api/utils/define-page-meta) compiler macro.
|
|
108
108
|
|
|
109
|
-
```diff [pages/index.vue]
|
|
109
|
+
```diff [app/pages/index.vue]
|
|
110
110
|
- <script>
|
|
111
111
|
- export default {
|
|
112
112
|
- scrollToTop: false
|
|
@@ -126,7 +126,7 @@ Similar to `key`, specify it within the [`definePageMeta`](/docs/api/utils/defin
|
|
|
126
126
|
|
|
127
127
|
The validate hook in Nuxt 3 only accepts a single argument, the `route`. Just as in Nuxt 2, you can return a boolean value. If you return false and another match can't be found, this will mean a 404. You can also directly return an object with `statusCode`/`statusMessage` to respond immediately with an error (other matches will not be checked).
|
|
128
128
|
|
|
129
|
-
```diff [pages/users/[id\\].vue]
|
|
129
|
+
```diff [app/pages/users/[id\\].vue]
|
|
130
130
|
- <script>
|
|
131
131
|
- export default {
|
|
132
132
|
- async validate({ params }) {
|
|
@@ -147,7 +147,7 @@ The validate hook in Nuxt 3 only accepts a single argument, the `route`. Just as
|
|
|
147
147
|
|
|
148
148
|
This is not supported in Nuxt 3. Instead, you can directly use a watcher to trigger refetching data.
|
|
149
149
|
|
|
150
|
-
```vue [pages/users/[id\\].vue]
|
|
150
|
+
```vue [app/pages/users/[id\\].vue]
|
|
151
151
|
<script setup lang="ts">
|
|
152
152
|
const route = useRoute()
|
|
153
153
|
const { data, refresh } = await useFetch('/api/user')
|