vue axios在IE浏览器的接口缓存问题 解决方案

  • 场景

当请求后端接口参数一样时,ie浏览器会自动读取接口的缓存数据,导致数据不能实时回显到的页面上

  • 解决方法:

在axios中参数加入时间戳,是每次调用接口的是参数不一致

get方式:

this.$axios({
    methods:'get',
    url:"",
    params:{
        date:Date.parse(new Date()) //加入时间戳
    }
})

post方式:

this.$axios({
    method:'post',
    url:"",
    params:{
        date:Date.parse(new Date()) //将时间戳拼接到url后边
    },
    data:{
        
    }
})

 

你可能感兴趣的:(vue问题总结)