安装jsonp
https://www.npmjs.com/package/vue-jsonp
//打开腾讯地图
navigation() {
let url = 'https://apis.map.qq.com/ws/geocoder/v1/';
this.$jsonp(url, {
key: '你的腾讯地图key',
address: this.list.address, //具体的地址
output: 'jsonp'
})
.then(res => {
console.log(res);
let lng = res.result.location.lng; //存储经度
let lat = res.result.location.lat; //存储纬度
window.location.href = `http://apis.map.qq.com/uri/v1/marker?marker=coord:(${lat},${lng})&addr:${this.list.address}`;
})
.catch(err => {
console.log(err);
});
},