diff --git a/src/utils/permission.js b/src/utils/permission.js index 6133d4f..8bc40d6 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -61,3 +61,13 @@ router.afterEach(async () => { await store.dispatch('GET_DEPLIST') }) + +router.onError((error) => { + const pattern = /Loading chunk (\d)+ failed/g + console.log('xcq --- pattern: ', pattern) + const isChunkLoadFailed = error.message.match(pattern) + const targetPath = router.history.pending.fullPath + if (isChunkLoadFailed) { + router.replace(targetPath) + } +})