vite-plugin-vue-layouts
vite-plugin-vue-layouts copied to clipboard
Deep work with vite-plugin-layout
Most of the cases, we use layout for a group of route placed in same folders. so is it possible to work with them like this to avoid use custom block
the new layout api is similar to dirs api
layouts: [
{ dir: "src/pages", layout: "src/layouts/default.vue" }, // this can be set by defualt .
{ dir: "src/features/**/pages", layout: "src/layouts/feature.vue" },
{ dir: "src/blank/pages", layout: "src/layouts/blank.vue" },
],
Yes, Come on
You can acheive this by passing the layout name through your route meta.
Personnaly I use this with Vue router:
main.js
routes.map(route => {
if (route.name === 'home') route.meta = { ...route.meta, ...{ layout: 'Home' }}
return route
})
Would it work for you?
I'd be open to a PR for this, but it's not something I have time to implement.