feat: 新增页面标签页组件

This commit is contained in:
ZhuRui
2026-07-27 16:29:12 +08:00
parent e238328919
commit 826a541a60
8 changed files with 529 additions and 47 deletions
+14
View File
@@ -1,5 +1,6 @@
import router from '@/router';
import { auth } from '@/hooks/useAuth';
import { useTabsStore } from '@/stores/tabsStore';
const appTitle = import.meta.env.VITE_APP_TITLE || 'CPMS 运营平台';
@@ -57,4 +58,17 @@ router.beforeEach(async (to, _from, next) => {
router.afterEach((to) => {
updateDocumentTitle(to.meta.title as string | undefined);
// ── 路由跳转 → tab 来源 ──
// 隐藏的路由(如详情页、编辑页)不进 tab,避免标签栏被噪声污染
// /login 也不进 tab
if (to.meta?.hideInMenu || to.path === '/login') return;
if (typeof to.name !== 'string' || typeof to.meta?.title !== 'string') return;
const { addTab } = useTabsStore();
addTab({
path: to.path,
name: to.name,
title: to.meta.title,
});
});