跨域請求攜帶cookie:
需要在代碼中加上:withCredentials:true,
參考資料:https://www.jianshu.com/p/552daaf2869c
axios發送post請求,參數傳遞不過去:
https://www.jianshu.com/p/042632dec9fb
【官網建議】:
https://github.com/axios/axios/blob/master/README.md#using-applicationx-www-form-urlencoded-format
axios中文說明:
https://www.kancloud.cn/yunye/axios/234845
var params={
captcha:this.identiCode,
first_name:this.firstname,
last_name:this.lastname,
userName:this.username,
passwd:this.psd,
email:this.email,
user_type:userType,
}
var qs=require('qs');
axios.post('http://version2.hemasao.com/user/doRegister',qs.stringify(params)).then(function(res){
//res=qs.parse(res);
console.log(res);
});
//設置跨域攜帶cookie
//在main.js里面加入這句話即可(全局默認配置設置方法)
axios.defaults.withCredentials=true