docs: update stability edge banners (#8498)

This commit is contained in:
pooya parsa 2022-10-26 15:17:52 +02:00 committed by GitHub
parent b010e3e861
commit ea6ebd0b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 19 deletions

View File

@ -126,8 +126,6 @@ The `validate` property accepts the `route` as an argument. You can return a boo
If you have a more complex use case, then you can use anonymous route middleware instead.
:StabilityEdge
```vue [pages/post/[id].vue]
<script setup>
definePageMeta({

View File

@ -236,7 +236,7 @@ export default defineNuxtConfig({
layoutTransition: {
name: 'slide',
mode: 'out-in' // default
}
}
}
})
```
@ -271,8 +271,6 @@ definePageMeta({
</script>
```
<!-- Remove this example in next RC: ::StabilityEdge -->
Or globally in the `nuxt.config`:
```ts [nuxt.config.ts]
@ -371,7 +369,7 @@ const next = computed(() => '/' + (id.value + 1))
<div>
<slot />
<div v-if="$route.params.id">
<NuxtLink :to="prev">⬅️</NuxtLink> |
<NuxtLink :to="prev">⬅️</NuxtLink> |
<NuxtLink :to="next">➡️</NuxtLink>
</div>
</div>

View File

@ -225,6 +225,8 @@ This feature only works with Nuxt auto-imports and `#components` imports. Explic
## `<DevOnly>` Component
:StabilityEdge
Nuxt provides the `<DevOnly>` component to render a component only during development.
The content will not be included in production builds and tree-shaken.

View File

@ -47,7 +47,7 @@ interface PageMeta {
**`alias`**
- **Type**: `string | string[]`
Aliases for the record. Allows defining extra paths that will behave like a copy of the record. Allows having paths shorthands like `/users/:id` and `/u/:id`. All `alias` and `path` values must share the same params.
**`keepalive`**
@ -81,9 +81,9 @@ interface PageMeta {
Define anonymous or named middleware directly within `definePageMeta`. Learn more about [route middleware](/guide/directory-structure/middleware).
**`pageTransition`**
- **Type**: `boolean` | [`TransitionProps`](https://vuejs.org/api/built-in-components.html#transition)
Set name of the transition to apply for current page. You can also set this value to `false` to disable the page transition.
**`redirect`**
@ -92,16 +92,12 @@ interface PageMeta {
Where to redirect if the route is directly matched. The redirection happens before any navigation guard and triggers a new navigation with the new target location.
:StabilityEdge
**`validate`**
- **Type**: `(route: RouteLocationNormalized) => boolean | Promise<boolean> | Partial<NuxtError> | Promise<Partial<NuxtError>>`
Validate whether a given route can validly be rendered with this page. Return true if it is valid, or false if not. If 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).
:StabilityEdge
**`[key: string]`**
- **Type**: `any`
@ -143,18 +139,18 @@ The example below shows how the middleware can be defined using a `function` dir
middleware: [
function (to, from) {
const auth = useState('auth')
if (!auth.value.authenticated) {
return navigateTo('/login')
}
return navigateTo('/checkout')
}
],
// ... or a string
middleware: 'auth'
// ... or multiple strings
middleware: ['auth', 'another-named-middleware']
})
@ -170,7 +166,7 @@ You can define the layout that matches the layout's file name located (by defaul
definePageMeta({
// set custom layout
layout: 'admin'
// ... or disable a default layout
layout: false
})

View File

@ -114,8 +114,6 @@ See [layout migration](/migration/pages-and-layouts).
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).
:StabilityEdge
```diff [pages/users/[id].vue]
- <script>
- export default {