uni-app 写公众号 小程序 使用腾讯地图获取地理位置
1.首先需要在腾讯地图里面申请key
3.引入js文件
4.在需要的页面引入
5. 小程序代码
success: function (res) { that.longitude = res.longitude that.latitude = res.latitude let qqmapsdk = new QQMapWX({ qqmapsdk.reverseGeocoder({ that.address = data.result.address
6.H5代码
注意:H5 端获取定位信息,要求部署在 https 服务上,本地预览(localhost)仍然可以使用 http 协议,如果想在页面查看效果的话,可以使用火狐浏览器看返回的信息
qqMap: new QQMapWX({key: '申请的key',vm: this}), success: function (res) { that.longitude = res.longitude that.latitude = res.latitude that.qqMap.reverseGeocoder({ that.address = data.result.address
这就完成啦~
|