No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Using pages and data

    Help
    3
    5
    722
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      Oxar last edited by

      Hi
      I built an app with several tabs in index.vue. My codebase has become quite bloated and not easy to navigate through. I would like to use pages and have a file (e.g. page1.vue) for each of these tabs. So index.vue would consist of data, methods, tabs and pages routes.
      Since each page would contain the following

      <template>
       ... html code ...
      </template>
      <script>
      data () {
      },
      methods: {
      }
      </script> 
      
      

      What should I do to get the data in all the pages and have it all in one place in index.vue? Is it something similar to components?

      thanks

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        Use Vuex. Read Vuex docs first, then head to Quasar docs: https://quasar-framework.org/guide/app-vuex-store.html

        Also additional read:

        • https://quasar-framework.org/guide/app-adding-pages-and-layouts.html
        • https://quasar-framework.org/guide/app-routing.html

        Make sure you understand how Vue Router works before diving in.

        1 Reply Last reply Reply Quote 1
        • O
          Oxar last edited by

          Thanks @rstoenescu. Is Vuex the only option available?

          1 Reply Last reply Reply Quote 0
          • rstoenescu
            rstoenescu Admin last edited by

            No. You could build a similar store with a JS object that you import where you need it, but I don’t recommend it unless you really know how Vue works.
            Don’t be scared of Vuex though.

            1 Reply Last reply Reply Quote 0
            • nothingismagick
              nothingismagick last edited by

              technically you could also make a so-called global mixin and integrate it as a plugin via the standard quasar.conf.js approach, but I highly recommend VUEX too.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post