1.引入QQMapWX
import QQMapWX from '../../utils/qqmap-wx-jssdk.min.js'
2.微信公众号配置请求域名 https://apis.map.qq.com
3.//百度经纬度转换腾讯经纬度
reverseLocation () {
console.log('bd', Number(this.data.info.dimension), Number(this.data.info.longitude))
// 实例化API核心类
var demo = new QQMapWX({
key: '你的key'
});
// 调用接口
demo.reverseGeocoder({
location: {
latitude: Number(this.data.info.dimension),
longitude: Number(this.data.info.longitude)
},
coord_type: 3, //baidu经纬度
success: (res)=> {
var latitude = res.result.location.lat;
var longitude = res.result.location.lng;
this.setData({
latitude: latitude,
longitude: longitude
})
console.log('tx', latitude, longitude)
},
fail: (error)=> {
console.error(error);
},
complete: (res)=> {
console.log(res);
}
});
},
4.//打开地图
toMap() {
var lat = Number(this.data.latitude)
var lon = Number(this.data.longitude)
console.log(lat, lon)
wx.openLocation({ // 打开微信内置地图,实现导航功能(在内置地图里面打开地图软件)
latitude: lat,
longitude: lon,
name: this.data.info.name,
success: (res)=> {
console.log(res);
},
fail: (res)=> {
console.log(res);
}
})
},
-----------------------------------------------------------------------------------------
http://lbs.qq.com/service/webService/webServiceGuide/webServiceTranslate