Skip to content

Commit

Permalink
docs: update examples of dynamic pageKey (#22920)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Aug 31, 2023
1 parent 2d46971 commit 559a723
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/2.guide/2.directory-structure/1.pages.md
Expand Up @@ -205,7 +205,7 @@ If you want more control over when the `<NuxtPage>` component is re-rendered (fo
<template>
<div>
<h1>I am the parent view</h1>
<NuxtPage :page-key="someKey" />
<NuxtPage :page-key="route => route.fullPath" />
</div>
</template>
```
Expand Down
6 changes: 6 additions & 0 deletions docs/3.api/2.components/2.nuxt-page.md
Expand Up @@ -34,6 +34,12 @@ For example, passing `static` key, `NuxtPage` component is rendered only once wh
<NuxtPage page-key="static" />
```

You can also use a dynamic key based on the current route. (Don't use `$route` object here as it can cause problems with how `<NuxtPage>` renders pages with `<Suspense>`.)

```html
<NuxtPage :page-key="route => route.fullPath" />
```

Alternatively, `pageKey` can be passed as a `key` value via `definePageMeta` from the `<script>` section of your Vue component in the `/pages` directory.

```js
Expand Down

0 comments on commit 559a723

Please sign in to comment.