Skip to content

Commit 8cbb340

Browse files
committed
确保 router.close 方法在 router.push 后处理 tabbar 状态
1 parent 1dd7a03 commit 8cbb340

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/router/extensions.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ declare module 'vue-router' {
6666

6767
function extendClose(router: Router) {
6868
router.close = function (to: RouteLocationRaw) {
69-
const settingsStore = useSettingsStore(pinia)
70-
if (settingsStore.settings.tabbar.enable) {
71-
const tabId = getId(router)
72-
const tabbarStore = useTabbarStore(pinia)
73-
tabbarStore.remove(tabId)
74-
}
75-
return router.push(to)
69+
const currentRoute = router.currentRoute.value
70+
const tabId = getId(router)
71+
return router.push(to).then(() => {
72+
const settingsStore = useSettingsStore(pinia)
73+
if (settingsStore.settings.tabbar.enable && currentRoute.meta.tabMerge !== 'activeMenu') {
74+
const tabbarStore = useTabbarStore(pinia)
75+
tabbarStore.remove(tabId)
76+
}
77+
})
7678
}
7779
}
7880

0 commit comments

Comments
 (0)