Commit f365f8a6 authored by zhangyanni's avatar zhangyanni

错误处理

parent a4b9d519
......@@ -238,6 +238,15 @@ router.beforeEach((to, from, next) => {
document.body.scrollTop=document.documentElement.scrollTop=0;
});
router.onError((error) => {
const pattern = /Loading chunk (\d)+ failed/g;
const isChunkLoadFailed = error.message.match(pattern);
const targetPath = router.history.pending.fullPath;
if (isChunkLoadFailed) {
router.replace(targetPath);
}
});
// 为了实现Class的私有属性
const showMessage = Symbol('showMessage')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment