点击标题关闭所有tab

This commit is contained in:
2026-08-23 16:12:57 +08:00
parent fe008ce383
commit a4b3c241a2
+19 -1
View File
@@ -12,7 +12,7 @@
class="mobile-hamburger"
@toggleClick="toggleSideBar"
/>
<span class="sys-title">教学管理信息系统</span>
<span class="sys-title" title="关闭所有已打开的页签" @click="handleCloseAllTabs">教学管理信息系统</span>
</div>
<semester-bar class="top-header__center" />
<navbar class="top-header__right" :header-mode="true" />
@@ -69,6 +69,16 @@ export default {
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
handleCloseAllTabs() {
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
const last = visitedViews[visitedViews.length - 1]
if (last) {
this.$router.push(last.fullPath).catch(() => {})
} else {
this.$router.push('/').catch(() => {})
}
})
}
}
}
@@ -129,6 +139,14 @@ export default {
white-space: nowrap;
letter-spacing: 1.5px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
cursor: pointer;
border-radius: 6px;
padding: 4px 10px;
transition: background 0.25s ease;
&:hover {
background: rgba(255, 255, 255, 0.15);
}
}
}