Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,关于一些重写api的问题 #7

Open
rosa5500 opened this issue Jun 27, 2024 · 0 comments
Open

你好,关于一些重写api的问题 #7

rosa5500 opened this issue Jun 27, 2024 · 0 comments

Comments

@rosa5500
Copy link

rosa5500 commented Jun 27, 2024

起因:app.js引入weconsole之后,报错。定位之后,发现是因为relaunch的传参错误,原始代码传入了url字符串。

// app.js
onShow(options) {
    wx.getStorage({
        key: 'sid',
        success(res) {
            that.setSid(res.data.value);
            that.storeBindings.updateStoreBindings();
        },
        fail(err) {
            wx.nextTick(() => {
                wx.reLaunch(HOME_PATH); // ****************报错行数,HOME_PATH='/page/home/index'
                // 正确的写法  wx.reLaunch({url: HOME_PATH}); 
            });
        }
    });
}

报错控制台
image

Error: MiniProgramError
{"errno":1001,"errMsg":"reLaunch:fail parameter error: parameter.url should be String instead of Undefined;"}
    at Object.errorReport (WAServiceMainContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at Function.thirdErrorReport (WAServiceMainContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at Object.thirdErrorReport (WAServiceMainContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at i (WASubContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at Object.cb (WASubContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at V._privEmit (WASubContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at V.emit (WASubContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at WASubContext.js?t=wechat&s=1719467770338&v=3.3.3:1
    at n (WASubContext.js?t=wechat&s=1719467770338&v=3.3.3:1)
    at Le (WASubContext.js?t=wechat&s=1719467770338&v=3.3.3:1)(env: macOS,mp,1.06.2405020; lib: 3.3.3)

我的问题是,为什么我不用这个包不会引发这个错误?(同样走入了fail()函数中)。我看readme里面说有重写一些方法(console和api),猜测是这个原因。是重写了console的原因还是重写relaunch的原因?想问下,具体是重写了什么内容?影响范围是什么吗?

感谢~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant