调用百度地图ip获取定位接口,已经成功返回数据,但是报了跨域错误,导致回调方法无法执行。求教
Failed to load https://api.map.baidu.com/loc...: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://127.0.0.1:8087' is therefore not allowed access.
this.$http.get(`https://api.map.baidu.com/location/ip?ak=${AK}&coor=bd09l`).then(res => {
console.log(res);
this.x = res.location;
this.y = res.latitude;
let mk = new BMap.Marker(res.point);
map.addOverlay(mk);
map.panTo(res.point);
})