// 地图选位置
mapClick() {
let _this = this;
uni.chooseLocation({
success: function(res) {
console.log(res);
// 地图key
var mapkey = uni.getStorageSync('webConfig').web_config_str.mapkey;
// 引入腾讯地图SDK核心类
var QQMapWX = require('@/util/qqmap-wx-jssdk.min.js');
var qqmapsdk = new QQMapWX({
key: mapkey,
});
// 根据经纬度获取所在位置
qqmapsdk.reverseGeocoder({
location: {
longitude: res.longitude,
latitude: res.latitude,
},
success: function(reverseRes) {
console.log("==根据经纬度获取所在位置==");
console.log(reverseRes);
_this.province = reverseRes.result.ad_info.province;
_this.city = reverseRes.result.ad_info.city;
_this.area = reverseRes.result.ad_info.district;
}
});
_this.longitude = res.longitude;
_this.latitude = res.latitude;
_this.address = res.name;
_this.$forceUpdate();
}
});
},