feat: 新增初始化函数,全局异步错误捕获功能

This commit is contained in:
奔跑的面条
2023-02-02 20:54:02 +08:00
parent 3a256cbd88
commit 68b8809a1e
3 changed files with 14 additions and 2 deletions
+9
View File
@@ -0,0 +1,9 @@
/**
* * 页面初始化就执行的函数
*/
export const initFunction = async () => {
// 捕获全局错误
window.addEventListener("unhandledrejection", event => {
console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
});
}