Skip to content

Commit a34f33c

Browse files
author
gumingchen
committed
bug fix
1 parent 0eb2a7b commit a34f33c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/router/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,15 @@ router.afterEach((_to, _from) => {
219219
NProgress.done()
220220
})
221221

222+
// 添加异常处理
223+
const originalPush = router.push
224+
router.push = (to) => {
225+
  try {
226+
    return originalPush(to)
227+
  } catch (error) {
228+
    console.log(`%c${ error }`, 'color:red')
229+
    return originalPush({ name'401' })
230+
  }
231+
}
232+
222233
export default router

src/store/modules/tab/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export default {
7272
let val = `${ route.name as string }-${ meta.id }`
7373
if (meta.multiple) {
7474
val += `-${ queryStr }-${ paramsStr }`
75+
} else {
76+
val += `-{}-{}`
7577
}
7678
const tab: Tab = {
7779
value: val,

0 commit comments

Comments
 (0)