1.亲测没有用:
// axios.defaults.headers.common['Cache-Control'] = 'no-cache' // 头部添加不使用缓存,避免IE存在在当前页面没刷新的情况下再次请求接口直接拿缓存
2.解决:
const baseRequest = (config) => {
config.headers = {
Pragma: 'no-cache',
...authHeader()
}
export default {
get (url, params, config) {
return baseRequest({
method: 'get',
url,
params,
...config
})
},
post (url, data, config) {
return baseRequest({
method: 'post',
url,
data,
...config
})
},
put (url, data, config) {
return baseRequest({
method: 'put',
url,
data,
...config
})
},
delete (url, data, config) {
return baseRequest({
method: 'delete',
url,
data,
...config
})
}
}