Skip to content

Commit

Permalink
fix: clicking tab bar's action "Close other" causes duplicated route
Browse files Browse the repository at this point in the history
  • Loading branch information
w2xi committed Oct 18, 2024
1 parent d683d9c commit 8b7316c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pages/layout/tabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function TabBar() {
const index = visitedRoutes.findIndex(route => route.path === location.pathname)
const affixTags = initAffixTags(menuList)
const currentRoute = visitedRoutes[index]

switch (key) {
case 'close': {
if (!currentRoute.affix) {
Expand All @@ -51,7 +52,7 @@ function TabBar() {
break
}
case 'close-others': {
setVisitedRoute(affixTags.concat(visitedRoutes[index]))
addVisitedRoute(affixTags.concat(currentRoute))
break
}
case 'close-all': {
Expand Down

0 comments on commit 8b7316c

Please sign in to comment.