Skip to content

Commit

Permalink
docs: add config for unplug-vue-router
Browse files Browse the repository at this point in the history
closes #129
  • Loading branch information
JohnCampionJr committed Dec 12, 2023
1 parent a261293 commit 5542aa7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {

In main.ts, you need to add a few lines to import the generated code and setup the layouts.

## vue-router
```js
import { createRouter } from 'vue-router'
import { setupLayouts } from 'virtual:generated-layouts'
Expand All @@ -59,6 +60,17 @@ const router = createRouter({
});
```

## [unplugin-vue-router](https://github.com/posva/unplugin-vue-router)
```js
import { createRouter } from 'vue-router/auto'
import { setupLayouts } from 'virtual:generated-layouts'

const router = createRouter({
// ...
extendRoutes: (routes) => setupLayouts(routes),
})
```

## Client Types
If you want type definition of `virtual:generated-layouts`, add `vite-plugin-vue-layouts/client` to `compilerOptions.types` of your `tsconfig`:
```json
Expand Down

0 comments on commit 5542aa7

Please sign in to comment.