/** * Frame level types */ import type { Component } from 'vue'; import type { RouteRecordRaw } from 'vue-router'; /** 通用的菜单配置数据结构 */ export interface MenuConfig { /** 菜单图标样式名称 */ iconClass?: string; /** 菜单顺序号 */ order?: number; /** 菜单scope,相同的layout显示不同的菜单时,使用scope来过滤菜单 */ menuScope?: string; /** 不在菜单中显示 */ hidden?: boolean; /** 指定要高亮的菜单对应的路由名称 */ activeRouteName?: string; /** 菜单权限表达式 */ perm?: string[]; /** 跳转到链接 */ linkUrl?: string; /** 是否新窗口打开 */ linkBlank?: boolean; } export interface MenuMeta { title: string; menuConfig: MenuConfig; } export interface MenuItemData { path: string; meta?: MenuMeta; children?: MenuItemData[]; } /** 布局路由的名称类型,具体项目中通常为项目中所有布局名称的联合字面量类型,比如: 'base' | 'admin' | 'profile' */ export type LayoutRouteName = string; /** * @name LayoutRouteConfig * @description 布局路由配置数据,用于生成基础的布局框架路由 * @template T 布局路由名称,通常为项目中所有布局名称的联合字面量类型,比如: 'base' | 'admin' | 'profile' */ export type LayoutRouteConfig = { /** 路由名称,同时会作为布局路由的路径 `/${name}` */ name: T; /** 路由框架组件 */ component: Component; }; /** * @name LayoutRouteRecordData * @description 根据布局路由名称生成的布局路由数据类型,用户配置路由数据时, * 指定跟路由为某个具体的布局框架,如果不指定框架,则指定为'route',,比如以下该类型的路由配置结构: * { * base: [{ path: '/home', name: 'home', component: Home }], * profile: [{ path: '/personal', name: 'personal', component: Personal}], * route: [{ path: '/login', name: 'login', component: Login }] * } * 分别指定了三个页面:home、personal、login的页面框架路由为base、profile、route, * 其中login页面设定为route,表示不适用任何页面框架 * @template T 布局路由名称,通常为项目中所有布局名称的联合字面量类型,比如: 'base' | 'admin' | 'profile' */ export type LayoutRouteRecordData = Partial>;