feat: 新增页面标签页组件
This commit is contained in:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user