官方地址:https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html
1 wx.getLocation({ 2 type: \'wgs84\', 3 success (res) { 4 const latitude = res.latitude 5 const longitude = res.longitude 6 const speed = res.speed 7 const accuracy = res.accuracy 8 } 9 })
获取到经纬度,并不能直接获取直接地址信息,需要进行解析
我在网上找到百度API
https://api.map.baidu.com/geocoder/v2/?ak=36fcc51e203c9958959d419e24238112&callback=renderReverse&location=\' + latitude + \',\' + longitude + \'&output=json&pois=1&qq-pf-to=pcqq.c2c\'
未经百度许可请勿商用