Comments (5)
@mathieu-gilloots
Look at this: https://github.com/posva/unplugin-vue-router#extendroutes
You need to create router in this way:
import { createRouter } from 'vue-router/auto'
import { setupLayouts } from 'virtual:generated-layouts'
const router = createRouter({
// ...
extendRoutes: (routes) => setupLayouts(routes),
})
from vite-plugin-vue-layouts.
Added this to README
from vite-plugin-vue-layouts.
Nothings jumping out at me. Can you provide a repro or compare to Vitesse? https://github.com/antfu/vitesse/blob/main/src/main.ts
from vite-plugin-vue-layouts.
Hello,
Thanks for your answer.
I will try to create a repro.
The difference with vitesse : I'm not using VueSSG.
I create a router.
const router = createRouter(<RouterOptions>{
history: createWebHistory(),
routes: importedRoutesWithLayout,
})
And I'm passing this router to Vue with use
method :
Vue.use(router)
, before mounting the app.
from vite-plugin-vue-layouts.
Hello @JohnCampionJr & @hihanley
Just tried, it's written in the doc of unplugin-vue-router
.
Need to use the extendRoutes and it's works !
Thanks
from vite-plugin-vue-layouts.
Related Issues (20)
- How to set up without requiring layout HOT 5
- default layout not processed when using sub folder without a layout HOT 7
- Routing nesting problem HOT 2
- Nested page render the default layout even set to another layout HOT 2
- The routing nesting problem is still unresolved HOT 5
- Why are ['node_modules', '**/__*__/*'] excluded by default? HOT 7
- Does Named Views support? HOT 1
- File changes in version 0.11.0 do not trigger hot updates of vite (vite5.0.11) HOT 6
- Params route inherit default layout HOT 3
- Nested Pages (unplugin-vue-router) nest the layout pages HOT 3
- It seems doesn't work will with .jsx file. HOT 1
- HMR does not works when work with `unplugin-vue-router` HOT 1
- Not working with nested pages HOT 4
- Empty file route should not generate layout HOT 1
- [Feature Request] Allow `defaultLayout` accept a function
- Nested Pages - disable Layout HOT 1
- Can support dir layout component?
- does it support vue 2.7 with vite ? HOT 1
- Scrolling to an element does not work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-vue-layouts.