一、问题现象
Access to XMLHttpRequest at 'http://127.0.0.1:7001/api/user/list' from origin 'http://localhost:8080' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
vue-resource.esm.js?28dd:996 GET http://127.0.0.1:7001/api/user/list net::ERR_FAILED
二、解决方案
this.$http.get(api,{credentials:true}).then((response)=>{
console.log(response);
},(err)=>{
console.log(err);
})
修改为
this.$http.get(api).then((response)=>{
console.log(response);
},(err)=>{
console.log(err);
})