vue項目,解決ie緩存問題

 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
    })
  }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章