vuems icon indicating copy to clipboard operation
vuems copied to clipboard

Pages folder for nothing?

Open lepicekmichal opened this issue 4 years ago • 3 comments

So, is there a purpose for pages folder now? Besides separation of course.

My point being: is there a way to setup automatic creation by nuxt into modules pages? Or is it something possible and will be made in future?

lepicekmichal avatar Jul 04 '21 16:07 lepicekmichal

As you can see here , pages registered manually. import.js and router.js. And I like the idea.

If there are pages in defferent modules, we need create deep nesting to create needed url

pages/store/product/:id pages

  • store --product --- _id.vue --- list.vue

Folder into folder multiple times. And it's not cool, as for me

MichaelGitArt avatar Jul 05 '21 18:07 MichaelGitArt

I'm not sure if I understand the question completely, but I will try to answer.

By dividing the project into modules we can have many different routings for a module. The VueMS mechanism needs to see the routing files to link them and add additional mechanisms. We currently have no plans to implement a mechanism that will dynamically generate routing, but we still want to stick to the convention borrowed from NuxtJS.

As for the structure of the pages directory - this is a structure based on the NuxtJS convention, we didn't modify anything here.

bleto avatar Jul 07 '21 07:07 bleto

Manual overwrite of routes is fine, but i would still like default automatic creation. So I am not asking to replace anything, I just don't see the reason for necessary manual routing.

As these two examples are interchangeable as far as generating is concerned:

(original nuxt)

  • pages
    • user
      • id.vue
      • index.vue
    • article
      • id.vue
      • index.vue

(vuems)

  • modules
    • user
      • pages
        • id.vue
        • index.vue
    • article
      • pages
        • id.vue
        • index.vue

I am now playing with my own fork of https://github.com/ktsn/vue-route-generator to make exatly this possible, and so far haven't found a blocking issue. But maybe it is possible and I just can't read your documentation right :grinning:. Please advise.

lepicekmichal avatar Jul 07 '21 07:07 lepicekmichal