|
@@ -90,4 +90,16 @@ const router: Router = createRouter({
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+router.onError(error => {
|
|
|
|
+ if (error instanceof Error) {
|
|
|
|
+ const isChunkLoadFailed = error.name.indexOf('chunk');
|
|
|
|
+ const targetPath = router.currentRoute.value.fullPath;
|
|
|
|
+ console.log(error);
|
|
|
|
+ if (isChunkLoadFailed) {
|
|
|
|
+ location.hash = targetPath;
|
|
|
|
+ window.location.reload();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
export default router;
|
|
export default router;
|