Usage of q-page



  • I would like to know is it possible to use q-page directly within the MainLayout like this:

    <!-- vue file for Layout (e.g. MainLayout.vue) -->
    <q-layout>
      ...
      <q-page-container>
        <q-page>
          <router-view />
        </q-page>
      </q-page-container>
      ...
    </q-layout>
    

    I tried it and it works well. So for me it seems to be easier using it directly in MainLayout, because then q-page should be used automaticaly for every page. But has it any drawback?



  • yeah, since it’s a child of q-page-container.



  • Well, what if you need multiple elements in the same q-page? Cuz each component can only have one root element.

    I suppose you could wrap it in a div instead, but why not just make q-page the root element?



  • @walfin because you may want to declare the page and it’s properties once and not for every page.

    In the upcoming Vue3 you can have multiple root elements.



  • Thanks, thats what i wanted to know.
    @dobbel Yes, thats the case. I just want to declare it once and not in every single page.


Log in to reply