首页 > 编程 > JavaScript > 正文

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

2019-11-19 12:51:03
字体:
来源:转载
供稿:网友

设置 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丢失的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表