mirror of
https://gitee.com/dromara/go-view.git
synced 2026-05-12 00:00:01 +08:00
feat: 新增初始化函数,全局异步错误捕获功能
This commit is contained in:
@@ -2,3 +2,4 @@ export { setupNaive } from '@/plugins/naive'
|
||||
export { setupDirectives } from '@/plugins/directives'
|
||||
export { setupCustomComponents } from '@/plugins/customComponents'
|
||||
export { icon } from '@/plugins/icon'
|
||||
export { initFunction } from '@/plugins/initFunction'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* * 页面初始化就执行的函数
|
||||
*/
|
||||
export const initFunction = async () => {
|
||||
// 捕获全局错误
|
||||
window.addEventListener("unhandledrejection", event => {
|
||||
console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user