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

    Disable LoadingBar plugin for certain Ajax calls

    Help
    2
    3
    143
    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.
    • P
      perelin last edited by

      Hi all,

      I´m using the LoadingBar plugin but would like to disable it for certain Ajax calls. E.g. I´m polling some status from the backend server every few seconds and displaying a loading bar for every poll request doesnt make sense.

      Whats the recommended approach here?

      Thanks!

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

        @perelin I have a mixin that I include on certain pages that I want to hide the loading bar:

        export default {
          created() {
            this.loadingBarSize = this.$q.loadingBar.size
            this.$q.loadingBar.setDefaults({
              size: '0px'
            })
          },
          destroyed() {
            this.$q.loadingBar.setDefaults({
              size: this.loadingBarSize
            })
          },
        }
        

        This disables all loading bars on a certain page, but you could just do something like:

        methods: {
          async makeAjaxCall() {
            const loadingBarSize = this.$q.loadingBar.size
            this.$q.loadingBar.setDefaults({
              size: '0px'
            })
            
            // await some axios call
        
            this.$q.loadingBar.setDefaults({
              size: loadingBarSize
            })
          },
        }
        1 Reply Last reply Reply Quote 1
        • P
          perelin last edited by

          Will give it a try, thx!

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