How to use element ui's loading in axio.js 's interceptor to make all requests have the effect of loading

how to use element ui"s loading in axio.js "s interceptor, so that all requests have the effect of loading

Mar.28,2021

introduce element ui in the code file intercepted by axios
in the request interception of axios, full-screen load.
in the response interception of aixos, turn off loading.

//element-uiVue
//
const LOADING = {
  lock: true,
  spinner: 'el-icon-loading',
  background: 'rgba(0, 0, 0, 0.7)'
};
let loading;
//
axios.interceptors.request.use(config => {
  loading = Vue.$loading(LOADING);
  return config
}, error => {
  loading.close();
  return Promise.reject(error)
})
//
axios.interceptors.response.use(data => {
  loading.close();
  return Promise.resolve(data);
}, error => {
  loading.close();
  return Promise.reject(error)
})

register this component globally, import this component in app.vue, Vue.use (). When you go to the place where you request to set state, there is usually vuex to vuex directly to do, set two action methods. To manipulate the display of loading

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a0ca-2af26.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a0ca-2af26.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?