mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
docs(pages): add information for typing page metadata (#5270)
Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
parent
c071b1eb90
commit
d61864b1a9
@ -287,6 +287,21 @@ You can define transition properties for the `<transition>` component that wraps
|
|||||||
|
|
||||||
You can define page aliases. They allow you to access the same page from different paths. It can be either a string or an array of strings as defined [here](https://router.vuejs.org/guide/essentials/redirect-and-alias.html#alias) on vue-router documentation.
|
You can define page aliases. They allow you to access the same page from different paths. It can be either a string or an array of strings as defined [here](https://router.vuejs.org/guide/essentials/redirect-and-alias.html#alias) on vue-router documentation.
|
||||||
|
|
||||||
|
### Typing Custom Metadata
|
||||||
|
|
||||||
|
If you add custom metadata for your pages, you may wish to do so in a type-safe way. It is possible to augment the type of the object accepted by `definePageMeta`:
|
||||||
|
|
||||||
|
```ts [index.d.ts]
|
||||||
|
declare module '#app' {
|
||||||
|
interface PageMeta {
|
||||||
|
pageType?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// It is always important to ensure you import/export something when augmenting a type
|
||||||
|
export {}
|
||||||
|
```
|
||||||
|
|
||||||
## Navigation
|
## Navigation
|
||||||
|
|
||||||
To navigate between pages of your app, you should use the [`<NuxtLink>`](/api/components/nuxt-link) component.
|
To navigate between pages of your app, you should use the [`<NuxtLink>`](/api/components/nuxt-link) component.
|
||||||
|
Loading…
Reference in New Issue
Block a user