2024-12-02 17:07:21 +08:00
|
|
|
|
import type * as ElementPlusIconsVue from "@element-plus/icons-vue"
|
|
|
|
|
import type { SvgName } from "~virtual/svg-component"
|
2022-10-18 15:07:42 +08:00
|
|
|
|
import "vue-router"
|
2022-08-23 18:09:13 +08:00
|
|
|
|
|
2024-11-21 19:52:07 +08:00
|
|
|
|
export {}
|
|
|
|
|
|
2024-12-02 17:07:21 +08:00
|
|
|
|
type ElementPlusIconsName = keyof typeof ElementPlusIconsVue
|
|
|
|
|
|
2022-08-23 18:09:13 +08:00
|
|
|
|
declare module "vue-router" {
|
|
|
|
|
interface RouteMeta {
|
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 设置该路由在侧边栏和面包屑中展示的名字
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
|
|
|
|
title?: string
|
|
|
|
|
/**
|
2024-11-27 10:09:14 +08:00
|
|
|
|
* @description 设置该路由的图标,记得将 svg 导入 src/common/assets/icons
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
2024-12-02 17:07:21 +08:00
|
|
|
|
svgIcon?: SvgName
|
2022-09-30 17:41:47 +08:00
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 设置该路由的图标,直接使用 Element Plus 的 Icon(与 svgIcon 同时设置时,svgIcon 将优先生效)
|
2022-09-30 17:41:47 +08:00
|
|
|
|
*/
|
2024-12-02 17:07:21 +08:00
|
|
|
|
elIcon?: ElementPlusIconsName
|
2022-08-23 18:09:13 +08:00
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 默认 false,设置 true 的时候该路由不会在侧边栏出现
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
|
|
|
|
hidden?: boolean
|
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 设置能进入该路由的角色,支持多个角色叠加
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
|
|
|
|
roles?: string[]
|
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 默认 true,如果设置为 false,则不会在面包屑中显示
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
|
|
|
|
breadcrumb?: boolean
|
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 默认 false,如果设置为 true,它则会固定在 tags-view 中
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
|
|
|
|
affix?: boolean
|
|
|
|
|
/**
|
2024-11-26 17:20:15 +08:00
|
|
|
|
* @description 当一个路由的 children 属性中声明的非隐藏子路由只有 1 个且该子路由为叶子节点时,会将这个子路由当做父路由显示在侧边栏
|
|
|
|
|
* @description 当大于 1 个时,会恢复成嵌套模式
|
|
|
|
|
* @description 如果想不管个数总是显示父路由,可以在父路由上设置 alwaysShow: true
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
|
|
|
|
alwaysShow?: boolean
|
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 示例: activeMenu: "/xxx/xxx",
|
2024-11-26 17:20:15 +08:00
|
|
|
|
* @description 当设置了该属性进入路由时,则会高亮 activeMenu 属性对应的侧边栏
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 该属性适合使用在有 hidden: true 属性的路由上
|
2022-08-23 18:09:13 +08:00
|
|
|
|
*/
|
|
|
|
|
activeMenu?: string
|
2023-02-22 15:53:04 +08:00
|
|
|
|
/**
|
2024-11-25 14:21:18 +08:00
|
|
|
|
* @description 是否缓存该路由页面
|
|
|
|
|
* @description 默认为 false,为 true 时代表需要缓存,此时该路由和该页面都需要设置一致的 Name
|
2023-02-22 15:53:04 +08:00
|
|
|
|
*/
|
|
|
|
|
keepAlive?: boolean
|
2022-08-23 18:09:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|