axios跨域问题记录

axios({
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/json; charset=UTF-8',
'Access-Control-Allow-Origin': '*'
},//设置跨域请求头
method: "GET",//请求方式
url: vthis.$Config.getwLDataMessage+'?'+params,//请求地址
})
.then(function(res) {
console.log(JSON.stringify(res.data.data));
let rdata = res.data.data;
userModel.rowItems3 = rdata;
userModel.rowModal3 = true;
console.log(rdata);
})
.catch(function(err) {
console.log(err);
});

猜你喜欢

转载自www.cnblogs.com/bingco/p/9897712.html