欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-29 22:45:13
设置 axios.defaults.withcredentials = true 即可 示例代码: axios.defaults.withcredential...

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