VOOZH about

URL: https://quasar.dev/quasar-plugins/loading-bar/

⇱ LoadingBar | Quasar Framework


assignment_late
Why donate
travel_explore
API Explorer
build
Quasar CLI (with Vite)
Upgrade Guide
Creating a New Project
The /quasar.config File
Convert q/app-webpack Project
Browser Compatibility
TypeScript Support
Directory Structure
Commands List
CSS Preprocessors
Page Routing with VueRouter
Lazy Loading - Code Splitting
Handling Assets
Boot Files
Prefetch Feature
API Proxying
Handling Vite
Handling import.meta.env
State Management with Pinia
Lint and Format Code
Testing & Auditing
Developing Mobile Apps
Ajax Requests
Opening Dev Server To Public
build
Quasar CLI (with Webpack)
LoadingBar

The Quasar LoadingBar plugin offers an easy way to set up your app with a QAjaxBar in case you don’t want to handle a QAjaxBar component yourself.

For a demo, please visit the QAjaxBar documentation page.

Loading LoadingBar API...
Installation
Quasar CLI
Vite plugin
UMD

// quasar.config file

return {
 framework: {
 plugins: [
 'LoadingBar'
 ],
 config: {
 loadingBar: /* look at QuasarConfOptions from the API card */
 }
 }
}

LoadingBar options are same as when configuring a QAjaxBar.

WARNING

When using the UMD version of Quasar, all components, directives and plugins are installed by default. This includes LoadingBar. Should you wish to disable it, specify loadingBar: { skipHijack: true } (which turns off listening to Ajax traffic).

Usage

Inside Vue components:

import { useQuasar } from 'quasar'

setup () {
 const $q = useQuasar()

 $q.loadingBar.start()
 $q.loadingBar.stop()
 $q.loadingBar.increment(value)
}

Outside of Vue components:

import { LoadingBar } from 'quasar'

LoadingBar.start()
LoadingBar.stop()
LoadingBar.increment(value)

Setting Up Defaults

Should you wish to set up some defaults, rather than specifying them each time, you can do so by using quasar.config file > framework > config > loadingBar: {…} or by calling LoadingBar.setDefaults({...}) or $q.loadingBar.setDefaults({...}). Supports all QAjaxBar properties.

Inside Vue components:

import { useQuasar } from 'quasar'

setup () {
 const $q = useQuasar()

 $q.loadingBar.setDefaults({
 color: 'purple',
 size: '15px',
 position: 'bottom'
 })
}

Outside of Vue components (includes boot files):

import { LoadingBar } from 'quasar'

LoadingBar.setDefaults({
 color: 'purple',
 size: '15px',
 position: 'bottom'
})

Using an Ajax filter
v2.4.5+

Should you want to trigger LoadingBar only for some URLs, then you can use the setDefaults() method (described above) to configure the hijackFilter property:

import { LoadingBar } from 'quasar'

LoadingBar.setDefaults({
 // return a Boolean which has the meaning of
 // "does this URL should trigger LoadingBar?"
 hijackFilter(url) {
 // example (only https://my-service.com/* should trigger)
 return /^https:\/\/my-service\.com/.test(url)
 }
})

Caught a mistake?Edit this page in browser
1. Introduction
2. LoadingBar API
3. Installation
4. Usage
4.1. Setting Up Defaults
4.2. Using an Ajax filter
Copyright © 2015-present PULSARDEV SRL, Razvan Stoenescu