getLocation 成功了,但是对成功函数中返回的 res 的运用一个也不执行?
发布于 5 年前 作者 pinggong 2082 次浏览 来自 官方Issues

已解决:是该手机没有开定位功能


getLocation 失败,已确认授权。体验版,开发版;

在开发工具中是成功的,用的是同一个微信号,

system: iphone,ios 12.3.1,WeChat 7.0.8

getLocation() {

            wx.getLocation({
                type: 'gcj02',
                success: res => {
                    this.$util.setStor('location', res);
                    this.setData({
                        location: res
                    });
                    this.getMarkerList(res);
                    console.log('wx.getLocation:', res);
                    console.log('wx.getLocation success');
                },
                fail: err => {
                    console.log('wx.getLocation fail')//这个打印了
                },
                complete: () => {
                    console.log('wx.getLocation complete')
                    this.moveToLocation();
                }
            });
        },
2 回复

请求失败了肯定不执行啊

你确定你打印的那个输出,难道不是fail里边的?

回到顶部