Skip to content

Commit

Permalink
docs: Update doc for extendPageData
Browse files Browse the repository at this point in the history
  • Loading branch information
kefranabg committed Sep 10, 2019
1 parent a793312 commit 1e01200
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/docs/docs/plugin/option-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ import { SOURCE_DIR } from '@dynamic/constants'

## extendPageData

- Type: `Function`
- Type: `Function|AsyncFunction`
- Default: `undefined`

A function used to extend or modify the [$page](../guide/global-computed.md#page) object. This function will be invoking once for each page at compile time.
Expand Down Expand Up @@ -308,6 +308,16 @@ module.exports = {
}
```

Note that `extendPageData` can also be defined as an asynchronous function.

```js
module.exports = {
async extendPageData ($page) {
$page.xxx = await getAsyncData()
}
}
```

::: warning Note
These fields starting with an `_` means you can only access them during build time.
:::
Expand Down

0 comments on commit 1e01200

Please sign in to comment.