Browse Source

加载资源刷新优化

wolyshaw 4 years ago
parent
commit
afc09b0651
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/permission.js

+ 2 - 1
src/permission.js

@@ -16,7 +16,7 @@ let isOpen = false
 router.onError((error) => {
   if (error instanceof Error) {
     const isChunkLoadFailed = error.name.indexOf('chunk')
-    // const targetPath = router.history.pending.fullPath;
+    const targetPath = router.history.pending.fullPath;
     if (isChunkLoadFailed && !isOpen) {
       isOpen = true
       // console.log(router.app.$confirm)
@@ -28,6 +28,7 @@ router.onError((error) => {
       })
         .then(() => {
           // router.replace(targetPath);
+          location.hash = targetPath
           window.location.reload()
         })
         .catch(() => {