微信小程序如何获取当前地理位置信息?
小程序使用'wx.getLocation' 方法获取当前地理位置信息。
代码示例:
wx.getLocation({
type: 'wgs84',
success (res) {
console.log(res.latitude)
console.log(res.longitude)
}
})
参数说明:
- type: 坐标类型,默认为 wgs84,返回 gps 坐标。
- wgs84: 国际标准 GPS 坐标
- gcj02: 国测局坐标
- bd09: 百度坐标
返回值:
- latitude: 纬度
- longitude: 经度
原文地址: http://www.cveoy.top/t/topic/nOsG 著作权归作者所有。请勿转载和采集!