修改菜单逻辑.

This commit is contained in:
lijiahang
2023-08-02 17:08:40 +08:00
parent 4322f01354
commit 7915198be4
16 changed files with 230 additions and 94 deletions

View File

@@ -1,3 +1,6 @@
import { RouteLocationNormalized } from 'vue-router';
import { TagProps } from '@/store/modules/tab-bar/types';
export const REDIRECT_ROUTE_NAME = 'redirect';
export const LOGIN_ROUTE_NAME = 'login';
@@ -10,15 +13,6 @@ export const DEFAULT_ROUTE_NAME = 'workplace';
export const DEFAULT_ROUTE_FULL_PATH = '/dashboard/workplace';
/**
* 默认 tab 页面
*/
export const DEFAULT_TAB = {
title: 'menu.dashboard.workplace',
name: DEFAULT_ROUTE_NAME,
fullPath: DEFAULT_ROUTE_FULL_PATH,
};
/**
* 路由白名单
*/
@@ -28,3 +22,29 @@ export const WHITE_ROUTER_LIST = [
{ name: FORBIDDEN_ROUTER_NAME, children: [] },
{ name: REDIRECT_ROUTE_NAME, children: [] },
];
/**
* 默认 tab 页面
*/
export const DEFAULT_TAB = {
title: '工作台',
name: DEFAULT_ROUTE_NAME,
fullPath: DEFAULT_ROUTE_FULL_PATH,
};
/**
* router 转 tag
*/
// TODO 获取后端meta
export const routerToTag = (route: RouteLocationNormalized): TagProps => {
console.log(route);
// TODO 还是得需要 name 和 meta 的映射
const { name, meta, fullPath, query } = route;
return {
title: meta.locale || 'me',
name: String(name),
fullPath,
query,
ignoreCache: meta.ignoreCache,
};
};