在web配置中配置腾讯地图key
页面中具体使用
jumpMap() {
let that = this;
uni.chooseLocation({
success: function(res) {
that.cascade = res.address;
that.lat = res.latitude;
that.lng = res.longitude;
let url = 'https://apis.map.qq.com/ws/geocoder/v1/';
jsonp(url, {
key: 'M7VBZ-ONPCM-TCB63-6RKVK-UCMMO-65FTP',
location: res.latitude + ',' + res.longitude,
output: 'jsonp'
}).then(res => {
console.log('jsonp', res.result.address_component);
let {
province,
city,
district
} = res.result.address_component;
that.province = province;
that.city = city;
that.area = district;
console.log(province, city, district);
})
}
});
},
实现的地图效果