Ajax Bar is a component which displays a loading bar (like Youtube) whenever an Ajax call (regardless of Ajax library used) is in progress. It can be manually triggered as well.
For a more convenient usage, you may want to check LoadingBar Quasar plugin. This page describes how the QAjaxBar component works should you want to directly use it yourself. Otherwise, if you want Quasar to take care of setting everything up, head to the LoadingBar page.
As long as this component is rendered by Vue it will capture all Ajax calls.
The best way to use it is to place it in your App’s root component (
App.vue if you are using the default Quasar template):
Do not simultaneously use more than one Ajax Bar component in your App.
|Vue Property||Type||Default Value||Description|
|String||‘top’||Where to place the loading bar: ‘top’, ‘bottom’, ‘left’ or ‘right’.|
|String||‘4px’||Thickness of the loading bar.|
|String||‘red’||One from Quasar Color Palette.|
|Boolean||Reverse direction of loading bar.|
|Boolean||Avoid taking into account Ajax calls.|
Use this only if you want to also trigger it manually. Ajax calls trigger these methods automatically.
|Trigger loading bar.|
|Notify when event has finished.|
|Triggered when loading bar has been triggered for being displayed.|
|Triggered when loading bar has finished its work and becomes hidden.|
If multiple events are captured by Ajax Bar simultaneously,
@stopwill still be triggered only once: when loading bar starts showing up and when it becomes hidden.
Each Ajax call makes a
start() call when it is triggered. When it ends, it calls
stop(). So yes, if you also manually trigger Ajax Bar you must call
start() each time a new event is starting and
stop() each time an event finished. Ajax Bar knows to handle multiple events simultaneously.