axios的get请求禁止缓存
用axios拦截器拦截请求,为get请求添加时间戳
axios.create({ headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } }) //axios请求拦截器 axios.interceptors.request.use(config => { if (/get/i.test(config.method)) { //判断get请求 config.params = config.params || {}; config.params.t = new Date().valueOf(); //添加时间戳 } return config; }, error => { return Promise.reject(error); })
浙公网安备 33010602011771号