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

作者:袖梨 2022-06-25

设置 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);
  });

相关文章

精彩推荐