antfu-collective / vitesse

🏕 Opinionated Vite + Vue Starter Template
https://vitesse.netlify.app/
MIT License
8.79k stars 932 forks source link

layout feature doesn't work #517

Closed mamboer closed 9 months ago

mamboer commented 9 months ago

Describe the bug

Sub-pages always use the ‘default’ layout, even if a different layout name is set in the meta.

Reproduction:

  1. Checkout the code of the main branch from https://github.com/antfu/vitesse
  2. Add a test.vue layout in the src/layouts/ folder
    <template>
    <h1>Test Layout</h1>
    <RouterView />
    </template>
  3. Add a test page src/pages/test/index.vue, and specifed it's layout to test
    
    <template>
    <h1>Test Title</h1>
    </template>
meta: layout: test
5. Run the app via `pnpm i && pnpm dev`
6. Visit `http://localhost:3333/test/` in the browser
7. Comfirm that the test page doesn't use the test layout

## Reproduction project

https://github.com/mamboer/vitesse

Just checkout the code and run it.

### Reproduction

https://github.com/mamboer/vitesse

### System Info

```Shell
System:
    OS: macOS 14.1.2
    CPU: (8) arm64 Apple M2
    Memory: 97.30 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.11.0 - /Volumes/Pluto/dev/github/mamboer/vitesse/node_modules/.bin/pnpm
  Browsers:
    Chrome: 119.0.6045.199
    Safari: 17.1.2

Used Package Manager

pnpm

Validations

JohnCampionJr commented 9 months ago

This is an issue in vite-plugin-vue-layouts: https://github.com/JohnCampionJr/vite-plugin-vue-layouts/issues/120

I'm working on it; hope to have an update in the next day or two.

JohnCampionJr commented 9 months ago

I have released 0.9.0, it should fix this.

mamboer commented 9 months ago

Nice job 👍