/ introduce axios and loading and message components in element ui
import axios from "axios"
import {Loading, Message} from" element-ui"
/ / timeout
axios.defaults.timeout = 5000
/ / http request interceptor
var loadinginstace
axios.interceptors.request.use (config = > {
/ element ui Loading method
loadinginstace = Loading.service ({fullscreen: true})
return config
}, error = > {
loadinginstace.close ()
Message.error ({
message: ""
})
return Promise.reject (error)
})
/ / http response interceptor
axios.interceptors.response.use (data = > {/ / response successfully closed loading
loadinginstace.close ()
return data
}, error = > {
loadinginstace.close ()
Message.error ({
message: ""
})
return Promise.reject (error)
})
export default axios
for example, how can I change the setting of a loading that sometimes doesn"t want to jump out of elementUI?
ask God for advice!