源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

详解Vue用axios发送post请求自动set cookie

  • 时间:2020-11-20 10:49 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:详解Vue用axios发送post请求自动set cookie
vue-resource不再维护之后,我也用起了axios,但是死活无法设置服务器发送过来的cookie [img]http://files.jb51.net/file_images/article/201705/2017051016144954.png?2017410161512[/img] 后来查询文档发现,这个是要单独配置的。
// `withCredentials` indicates whether or not cross-site Access-Control requests
// should be made using credentials
withCredentials: false, // default
当我们把此配置项设置成默认配置项并且设置成true的时候,axios就可以设置cookies了。 全局默认配置设置方法:
axios.defaults.withCredentials=true
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部