第一次使用VUE进行开发,在获取图片验证码与服务器进行比对时,提示验证码错误,最后发现请求时未携带cookie,导致SESSIONID改变致使校验失败.

解决办法

Vue.http.options.emulateJSON = true;
Vue.http.options.xhr = { withCredentials: true }

//在拦截其中添加此属性即可
Vue.http.interceptors.push((request, next) => {
request.credentials = true
next()
})

//axios设置

axios.defaults.withCredentials=true

相关文章:

  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2022-01-08
  • 2022-12-23
  • 2018-11-26
猜你喜欢
  • 2021-09-25
  • 2022-03-06
  • 2022-12-23
  • 2021-05-26
  • 2022-02-07
相关资源
相似解决方案