hannoeru / vite-plugin-pages

File system based route generator for ⚡️Vite
MIT License
1.84k stars 127 forks source link

[Feature Request] support convention layouts #496

Closed liujiayii closed 2 months ago

liujiayii commented 3 months ago

Description

The directory structure is as follows:

.
└── src
    ├── layouts
    │   └── index.tsx
    └── pages
        ├── index.tsx
        └── users.tsx

The following routes will be generated:

[
  { 
    path: '/', 
    component: '@/layouts/index',
    routes: [
      { path: '', component: '@/pages/index' },
      { path: 'users', component: '@/pages/users' },
    ],
  },
]

Suggested solution

none

Alternative

No response

Additional context

No response

Validations

Jabberwocky238 commented 2 months ago

in version 0.32.3, i achieve this by accident if it could help

└── src
    └── pages
        └── user
            ├──index.vue
            ├──subpage2.vue
            └──[which]
                └──subsubpage.vue
        └── user.vue

The following routes will be generated:

[
  { 
    path: '/user', 
    component: '@/pages/user.vue',
    routes: [
      { path: '', component: '@/pages/user/index.vue' },
      { path: 'subpage2', component: '@/pages/user/subpage2.vue' },
      { path: ':which/subsubpage', component: '@/pages/user/[which]/subsubpage.vue' },
    ],
  },
]

and in this case, these are validated url

/user
/user/subpage2
/user/11111/subsubpage
hannoeru commented 2 months ago

Out of scope