fix: 资源加载失败时自动刷新页面
- 添加路由错误处理,当动态导入模块失败时自动刷新页面 - 修复 assets 文件不存在时返回 404 错误
This commit is contained in:
@@ -13,6 +13,12 @@ const router = createRouter({
|
||||
},
|
||||
})
|
||||
|
||||
router.onError((error) => {
|
||||
if (error.message.includes('Failed to fetch dynamically imported module')) {
|
||||
window.location.reload()
|
||||
}
|
||||
})
|
||||
|
||||
createRouterGuard(router)
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user