mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
docs: add more documentation for pages:routerOptions
This commit is contained in:
parent
b0f50bec1b
commit
46b5336718
@ -92,6 +92,27 @@ export default <RouterConfig> {
|
||||
}
|
||||
```
|
||||
|
||||
It is possible to add more router options files by adding files within the `pages:routerOptions` hook.
|
||||
|
||||
::alert
|
||||
Adding a router options file in this hook will switch on page-based routing, unless `optional` is set, in which case it will only apply when page-based routing is already enabled.
|
||||
::
|
||||
|
||||
```ts [nuxt.config.ts]
|
||||
export default defineNuxtConfig({
|
||||
hooks: {
|
||||
'pages:routerOptions' ({ files }) {
|
||||
const resolver = createResolver(import.meta.url)
|
||||
// add a route
|
||||
files.push({
|
||||
path: resolver.resolve('./runtime/app/router-options')
|
||||
optional: true
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Using `nuxt.config`
|
||||
|
||||
**Note:** Only JSON serializable [options](/docs/api/nuxt-config#router) are configurable:
|
||||
|
Loading…
Reference in New Issue
Block a user