当前位置:首页 > 操作系统 > Ios

基于axios 解决跨域cookie丢失的问题

设置 axios.defaults.withCredentials = true 即可

示例代码:

 axios.defaults.withCredentials = true;
 var param = new URLSearchParams();
 param.append("vCode",vcode);
 axios.post('http://localhost',param)
  .then(function(res) {
   var rs=res.data;
   console.log(rs.data);
  })
  .catch(function(err) {
   console.log(err);
  });

以上这篇基于axios 解决跨域cookie丢失的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持硕编程。


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐