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

只用alloyLever能触发window.onerror事件,但引入了Vconsole之后触发不了 #20

Open
Liqihan opened this issue Nov 30, 2017 · 1 comment

Comments

@Liqihan
Copy link

Liqihan commented Nov 30, 2017

这是只引入alloylever的情况,url上没有带vconsole
c1d28761-7c4c-4623-b633-85ed355c3213
url带上vconsole之后
12ae6fab-ceda-412e-b50b-caab89609067
看了源码,没看出什么问题,请帮忙解决

看了一下是vconsole的问题,他里面重写了window.onerror方法

f.isFunction(window.onerror) && (this.windowOnError = window.onerror), window.onerror = function (t, o, n, a, i) {
                            var r = t;
                            o && (r += "\n" + o.replace(location.origin, "")), (n || a) && (r += ":" + n + ":" + a), e.printLog({
                                logType: "error",
                                logs: [r],
                                noOrigin: !0
                            }), f.isFunction(e.windowOnError) && e.windowOnError.call(window, t, o, n, a, i)
                        }

Uploading B7F6C832-CA6D-44CF-B66C-23B7B0EED3BC.png…

这是编译后的代码,又把e.windowOnError置为null,所以导致之前定义的window.onerror执行失败,
vconsole的下载地址是

@wuliupo
Copy link

wuliupo commented Jan 9, 2019

你是单独又引用了一次 vconsole 吗?

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

2 participants