您的位置:首页 > 移动开发 > IOS开发

axios 解决跨域cookie丢失问题

2017-12-12 16:09 731 查看
设置 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);
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  cookie axios