fix: 优化页面标签组件与相关路由配置
This commit is contained in:
+5
-2
@@ -63,12 +63,15 @@ router.afterEach((to) => {
|
||||
// 隐藏的路由(如详情页、编辑页)不进 tab,避免标签栏被噪声污染
|
||||
// /login 也不进 tab
|
||||
if (to.meta?.hideInMenu || to.path === '/login') return;
|
||||
if (typeof to.name !== 'string' || typeof to.meta?.title !== 'string') return;
|
||||
if (typeof to.meta?.title !== 'string') return;
|
||||
|
||||
const componentName = (to.meta.componentName as string) || (to.name as string);
|
||||
if (!componentName) return;
|
||||
|
||||
const { addTab } = useTabsStore();
|
||||
addTab({
|
||||
path: to.path,
|
||||
name: to.name,
|
||||
name: componentName,
|
||||
title: to.meta.title,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user