0👍
If you are using a custom loading bar, you can manually control the loading bar at the appropriate position:
const start = () => {
if (process.browser && window.$nuxt) {
const {$loading} = window.$nuxt.$root;
$loading.start && $loading.start();
}
}
const stop = (abort) => {
if (process.browser && window.$nuxt) {
const {$loading} = window.$nuxt.$root;
$loading.finish && $loading.finish(abort);
}
}
You should call the start
method in the layout component or other reused place to display the loading bar.
For example, in my project, a custom loading animation needs to be displayed every time an http request is triggered, so I added the start method to the onRequest interceptor of axios.
export default function ({$axios}) {
$axios.onRequest(config => {
start()
// ...
})
$axios.onResponse(response => {
stop()
// ...
})
}
- [Vuejs]-Find Same Array and If condition have same I Will Update an Array Array on Vue Js
- [Vuejs]-Condiconal to send params via $emit according to the route you are VUE.js
Source:stackexchange.com