Skip to content

Commit

Permalink
feat(route): 路由meta新增activeMenu属性
Browse files Browse the repository at this point in the history
  • Loading branch information
yanbowe committed May 17, 2022
1 parent 84cb07b commit ebd16a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/layouts/common/GlobalHeader/components/HeaderMenu.vue
Expand Up @@ -21,7 +21,7 @@ const theme = useThemeStore();
const { routerPush } = useRouterPush();
const menus = computed(() => routeStore.menus as GlobalMenuOption[]);
const activeKey = computed(() => route.name as string);
const activeKey = computed(() => (route.meta?.activeMenu ? route.meta.activeMenu : route.name) as string);
function handleUpdateMenu(_key: string, item: MenuOption) {
const menuItem = item as GlobalMenuOption;
Expand Down
Expand Up @@ -53,7 +53,7 @@ const { title } = useAppInfo();
const showDrawer = computed(() => (props.visible && props.menus.length) || app.mixSiderFixed);
const activeKey = computed(() => route.name as string);
const activeKey = computed(() => (route.meta?.activeMenu ? route.meta.activeMenu : route.name) as string);
const expandedKeys = ref<string[]>([]);
function handleUpdateMenu(_key: string, item: MenuOption) {
Expand Down
Expand Up @@ -29,7 +29,7 @@ const theme = useThemeStore();
const routeStore = useRouteStore();
const { routerPush } = useRouterPush();
const activeKey = computed(() => route.name as string);
const activeKey = computed(() => (route.meta?.activeMenu ? route.meta.activeMenu : route.name) as string);
const expandedKeys = ref<string[]>([]);
function handleUpdateMenu(_key: string, item: MenuOption) {
Expand Down
2 changes: 2 additions & 0 deletions src/typings/route.d.ts
Expand Up @@ -93,6 +93,8 @@ declare namespace AuthRoute {
order?: number;
/** 表示是否是多级路由的中间级路由(用于转换路由数据时筛选多级路由的标识,定义路由时不用填写) */
multi?: boolean;
/** 当前路由需要选中的菜单项(用于跳转至不在左侧菜单显示的路由且需要高亮某个菜单的情况) */
activeMenu?: RouteKey;
};

/** 单个路由的类型结构(动态路由模式:后端返回此类型结构的路由) */
Expand Down

0 comments on commit ebd16a4

Please sign in to comment.