wx.getLocation 的使用
生活随笔
收集整理的這篇文章主要介紹了
wx.getLocation 的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
微信小程序獲取當前地理位置使用
wx.getLocation 方法,但是需要注意的使用這個別忘記申請權限
需要在app.json 中添加?permission ,如下
"permission": {"scope.userLocation": {"desc": "你的位置信息將用于小程序位置接口的效果展示"}},"sitemapLocation": "sitemap.json"
?
然后在使用
wx.getLocation({type: 'wgs84',success(res) {const latitude = res.latitudeconst longitude = res.longitudeconst speed = res.speedconst accuracy = res.accuracy}
})
總結
以上是生活随笔為你收集整理的wx.getLocation 的使用的全部內容,希望文章能夠幫你解決所遇到的問題。