Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with nested pages #148

Open
Monstermash28425R1 opened this issue Feb 27, 2024 · 4 comments
Open

Not working with nested pages #148

Monstermash28425R1 opened this issue Feb 27, 2024 · 4 comments

Comments

@Monstermash28425R1
Copy link

Monstermash28425R1 commented Feb 27, 2024

"I'm having issues with the plugin when working with nested pages. For instance, at the top-level, the plugin works fine, and at the second level too. However, when configuring a third level (pages/auth/login/index.vue), the plugin stops working. Could it be because the URLs are generated as 'childrens'?"

  • pages
    • index.vue //works
    • test
      • index.vue // works
    • auth
      • login
        • index.vue // doesnt work
@nigiwen
Copy link

nigiwen commented Apr 18, 2024

May I ask if you have resolved it

@WayneBuckhanan
Copy link

I found that explicitly setting a layout for each layer of directory structure resolved my similar issues.

E.g. having a meta layout set for pages/auth/index.vue above would allow pages/auth/login/index.vue to have a non-default meta layout work properly in my projects.

@sunpm
Copy link

sunpm commented May 19, 2024

Yeah, I have that problem too.

@Ali-Rooholamini
Copy link

"I found the solution to this problem. I am using a combination of this and the (unplugin-vue-router) package.
you need to change the folder structure of the pages to look like this:

  • pages
    • tickets
      • new
        • index.vue
      • index.vue
    • login.vue
    • [...path].vue
    • ...

"It means creating an index.vue file for each nested folder where you want to have its pages."

Next, you need to specify the layout of the pages in all layers, including layout: default:

pages/tickets/index.vue : (required)

<script setup>
definePage({
    meta: {
        layout: "default",
    },
});
</script>

then, inside pages/tickets/new/index.vue :

<script setup>
definePage({
    meta: {
        layout: "add",
    },
});
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants