收藏
回答

h5 jssdk中使用wx.getLocation获取定位,调用了没有任何回调是什么原因?

在微信小程序中使用web-view嵌入h5页面,h5使用微信jssdk wx.getLocation后,没有任何回调是什么原因?

代码片段:

    wx.getLocation({
        type: 'gcj02',
        success: (res) => {
            console.log('获取地理位置信息:', res);
            if (res && res.longitude && res.latitude) {
                successCB({
                    longitude: res.longitude,
                    latitude: res.latitude
                });
            } else {
                console.log('获取定位失败', e);
                if (failCB) {
                    failCB();
                }
            }


        },
        cancel: (e) => {
            console.log('用户取消了定位', e);
            if (failCB) {
                failCB();
            }
        },
        complete: (e) => {
            console.log('获取定位完成', e);
        },
        fail: (e) => {
            console.log('获取定位失败fail', e);
            if (failCB) {
                failCB();
            }
        }
    });


回答关注问题邀请回答
收藏

1 个回答

  • 智能回答 智能回答 本次回答由AI生成
    12-03
    有用
登录 后发表内容