refactor: 调整标签页关闭逻辑,优先跳转至前一个标签页

This commit is contained in:
Hooray
2025-05-01 20:09:23 +08:00
parent 9b5003fad8
commit e2d058abdd
+3 -3
View File
@@ -25,11 +25,11 @@ export default function useTabbar() {
// 如果关闭的标签正好是当前路由
if (tabId === activedTabId) {
const index = tabbarStore.list.findIndex(item => item.tabId === tabId)
if (index < tabbarStore.list.length - 1) {
close(tabbarStore.list[index + 1].fullPath)
if (index > 0) {
close(tabbarStore.list[index - 1].fullPath)
}
else {
close(tabbarStore.list[index - 1].fullPath)
close(tabbarStore.list[index + 1].fullPath)
}
}
else {