getLocation
发布于 6 年前 作者 likong 16524 次浏览 来自 问答

wx.ready(function() {        wx.getLocation({            type: ‘gcj02’,            success: function (res) {              let lated = res.latitude; // 纬度,浮点数,范围为90 ~ -90              let lnged = res.longitude; // 经度,浮点数,范围为180 ~ -180。              var speed = res.speed; // 速度,以米/每秒计              var accuracy = res.accuracy; // 位置精度            },            cancel: function (res) {                          },            fail: function (res) {              _this.showToast(‘请前往设置界面,检查是否开启定位!’);            }        });      })

您好,我是公众号开发,想问一下,这个fail事件是判断手机是否开启定位的功能吗?如果是的话,是根据什么result判断的,如果不是的话,微信有api提供我判断嘛?

回到顶部