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

    How to handle loading state in quasar

    Help
    3
    5
    699
    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.
    • G
      Gorgc last edited by Gorgc

      I want to show loading with spinner and logo for a few seconds when rendering a page, then the content of the page with show after that. How can i achieve this?

      beets 1 Reply Last reply Reply Quote 0
      • beets
        beets @Gorgc last edited by

        @gorgc One way is to modify App.vue to something like:

        <template>
          <div id="q-app">
            <router-view v-if="ready" />
            <q-spinner
              v-else
              color="primary"
              size="3em"
              />
          </div>
        </template>
        
        <script>
        import { mapState } from 'vuex'
        
        export default {
          name: 'App',
          computed: {
            ...mapState('my-module', ['ready']),
          }
        }
        </script>
        

        Then, when your app is ready, change the ready variable in vuex.

        G 1 Reply Last reply Reply Quote 1
        • G
          Gorgc @beets last edited by

          @beets how do i detect whether my app is ready or not and change the ready state in vuex?

          dobbel 1 Reply Last reply Reply Quote 0
          • dobbel
            dobbel @Gorgc last edited by

            @gorgc

            how do i detect whether my app is ready or not

            You can use the mounted hook on a page component. See:

            https://vuejs.org/v2/guide/instance.html#Instance-Lifecycle-Hooks

            and change the ready state in vuex?

            You will have to look up how vuex works.

            G 1 Reply Last reply Reply Quote 0
            • G
              Gorgc @dobbel last edited by

              @dobbel ok i got it, thank you everyone for the great help

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