手册目录
微信小程序 框架
微信小程序 WXML
表单组件
微信小程序导航
地图
媒体
绘图
开放接口
工具
微信小程序获取当前的地理位置、速度
OBJECT参数说明:

success返回参数说明:

示例代码:
wx.getLocation({
type: 'wgs84',
success: function (res) {
var latitude = res.latitude;
var longitude = res.longitude;
var speed = res.speed;
var accuracy = res.accuracy;
}
});
微信小程序使用微信内置地图查看位置
OBEJCT参数说明:

示例代码:
wx.getLocation({
type: 'gcj02', //返回可以用于wx.openLocation的经纬度
success: function (res) {
var latitude = res.latitude;
var longitude = res.longitude;
wx.openLocation({
latitude:latitude,
longitude:logitude,
scale:1
})
}
});
相关视频
科技资讯
24小时阅读榜
1
2
3
4
5
6
7
8
9
10
精品课程
共5课时 | 17.4万人学习
共49课时 | 78.2万人学习
共29课时 | 62.5万人学习
共25课时 | 39.7万人学习
共43课时 | 73.8万人学习