1.

首先,小程序里wx.getLocation可以获取用户当前的经纬度,即

wx.getLocation({type:'wgs84',success(res){console.log(res)constlatituderes.latitudeconstlongituderes.longitudeconstspeedres.speedconstaccuracyres.accuracy}})2.

2.访问https://lbs.qq.com/qqmap_wx_jssdk/index.html(腾讯地图服务),完成前三步操作:

3.

2、jdk的地址有的同学找不到,这里也贴上https://lbs.qq.com/qqmap_wx_jssdk/index.html

4.

3、如果是测试使用的化可以先不配置第三项。可以需要在开发工具详情中勾选如下操作:

5.

下面直接上代码即可

6.

index.wxml

buttonbindtap'aa'获取位置信息/button7.

index.js

//引入SDK核心类varQQMapWXrequire('../../utils/qqmap-wx-jssdk.min.js');//实例化API核心类vardemonewQQMapWX({key:'第一步申请的key'//必填});Page({aa(){//地理位置wx.getLocation({type:'wgs84',success(res){console.log(res)constlatituderes.latitudeconstlongituderes.longitudeconstspeedres.speedconstaccuracyres.accuracy//调用接口转换成具体位置demo.reverseGeocoder({location:{latitude:res.latitude,longitude:res.longitude},success:function(res){console.log(res.result);},fail:function(res){console.log(res);},})}})},})8.

按照上面的代码填写信息就可以在控制台获取到详情的位置信息的了。

TAG标签: 小程序获取用户位置详情信息怎么查看小程序的地址如何查看小程序

http://www.xiaochengxub.com/read-96079.html