垃圾IE会在发起请求的时候读取接口缓存,就贼蠢,我们要使用时间戳拼接在url来解决。最好不要直接加在参数上,怕后端会进行设置。
function filterUrl (url) {
return url.indexOf('?') !== -1 ? `${url}&time=${new Date().getTime()}` : `${url}?time=${new Date().getTime()}`
}
例子1:封装get
function get(params, url) {
return request({
url: filterUrl(url),
method: 'get',
params
})
}
例子2:封装post
function post(params, url, headersType) {
return request({
url: filterUrl(url),
method: 'post',
data: params,
headers: {
'Content-Type': headersType || 'application/x-www-form-urlencoded'
}
})
}
本文地址:https://blog.csdn.net/qq_40282732/article/details/107190273
如对本文有疑问, 点击进行留言回复!!
vue 动态设置img的src地址无效,npm run build 后找不到文件的解决
解决vue动态路由异步加载import组件,加载不到module的问题
解决vue的router组件component在import时不能使用变量问题
Vue中的this.$options.data()和this.$data用法说明
GBase 8a MPP Cluster使用Ceph做存储计算分离
网友评论