确保 router.close 方法在 router.push 后处理 tabbar 状态

This commit is contained in:
Hooray
2025-08-05 23:43:34 +08:00
parent 1dd7a03a84
commit 8cbb3402da
+9 -7
View File
@@ -66,13 +66,15 @@ declare module 'vue-router' {
function extendClose(router: Router) {
router.close = function (to: RouteLocationRaw) {
const settingsStore = useSettingsStore(pinia)
if (settingsStore.settings.tabbar.enable) {
const tabId = getId(router)
const tabbarStore = useTabbarStore(pinia)
tabbarStore.remove(tabId)
}
return router.push(to)
const currentRoute = router.currentRoute.value
const tabId = getId(router)
return router.push(to).then(() => {
const settingsStore = useSettingsStore(pinia)
if (settingsStore.settings.tabbar.enable && currentRoute.meta.tabMerge !== 'activeMenu') {
const tabbarStore = useTabbarStore(pinia)
tabbarStore.remove(tabId)
}
})
}
}