获取位置信息

发布于 7 年前作者 dcui4013 次浏览最后编辑 7 年前来自 ask

wx.getLocation({

    type: “gcj02”,

    success: function (res) {

        console.log(res.longitude);

        console.log(res.latitude);

    },

    fail: function (res) {

        console.log(res)

    }

});

在获取位置时,微信获取位置权限和小程序获取位置权限是打开的,手机定位 位置也是开启状态,是因为什么情况一直走fail错误的返回,是因为手机GPS信号弱还是因为网速慢

2 回复
nhan
nhan1 楼6 年前

我也遇到一样的问题,楼主有好的方法解决么

pliang
pliang2 楼5 年前

看代码没什么问题啊,你把res转成字符串打印出来看看