docs: recommend <NuxtLayout> when migrating error.vue (#20690)

This commit is contained in:
scscgit 2023-05-05 16:39:50 +02:00 committed by GitHub
parent ad97cb45ae
commit fa8b29a359
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,17 @@ You will also need to change how you define the layout used by a page using the
1. Replace `<Nuxt />` with `<slot />`
1. Use `definePageMeta` to select the layout used by your page.
1. Move `~/layouts/_error.vue` to `~/error.vue`. See [the error handling docs](/docs/getting-started/error-handling).
1. 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 [the `<NuxtLayout>` component](/docs/guide/directory-structure/layouts) directly within `error.vue`:
```vue
<template>
<div>
<NuxtLayout name="default">
<!-- -->
</NuxtLayout>
</div>
</template>
```
### Example: `~/layouts/custom.vue`