vite-plugin-vue-layouts icon indicating copy to clipboard operation
vite-plugin-vue-layouts copied to clipboard

Deep work with vite-plugin-layout

Open fyeeme opened this issue 2 years ago • 2 comments

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" },
],

fyeeme avatar Feb 09 '22 04:02 fyeeme

Yes, Come on

hunteryun avatar Mar 21 '22 11:03 hunteryun

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?

ziopod avatar Apr 07 '22 19:04 ziopod

I'd be open to a PR for this, but it's not something I have time to implement.

JohnCampionJr avatar Dec 05 '23 03:12 JohnCampionJr