1.在https://lbs.qq.com/console/mykey.html?console=mykey链接上申请一个密匙 2.在https://lbs.qq.com/qqmap_wx_jssdk/index.html下载微信小程序JavaScriptSDK 3.在页面引入文件var QQMapWX = require("../../../static/qqmap-wx-jssdk.min.js"); 4.var that = this; let qqmapsdk = new QQMapWX({
key: "****" // 密匙
});
wx.getLocation({
type: "gcj02",
success(res) {
//腾讯地图逆地址解析
qqmapsdk.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success(addressRes) {
that.address = addressRes.result.formatted_addresses.recommend; //获取地理位置名字
}
});
}
});
|
请发表评论