vue-element-plus-admin/types/router.d.ts

79 lines
2.8 KiB
TypeScript
Raw Normal View History

2021-12-30 17:25:51 +08:00
import type { RouteRecordRaw } from 'vue-router'
import { defineComponent } from 'vue'
/**
* redirect: noredirect noredirect
* name:'router-name' 使<keep-alive>
* meta : {
hidden: true true 404login等页面( false)
alwaysShow: true children 1
children
alwaysShow: true
( false)
title: 'title'
icon: 'svg-name'
noCache: true true <keep-alive> ( false)
breadcrumb: false falsebreadcrumb面包屑中显示( true)
affix: true truetag项中( false)
noTagsView: true truetag中( false)
activeMenu: '/dashboard'
canTo: true true即使hidden为true( false)
2023-08-05 17:43:24 +08:00
permission: ['edit','add', 'delete']
2021-12-30 17:25:51 +08:00
}
**/
2023-08-26 07:32:24 +08:00
interface RouteMetaCustom extends Record<string | number | symbol, unknown> {
hidden?: boolean
alwaysShow?: boolean
title?: string
icon?: string
noCache?: boolean
breadcrumb?: boolean
affix?: boolean
activeMenu?: string
noTagsView?: boolean
canTo?: boolean
permission?: string[]
}
2021-12-30 17:25:51 +08:00
declare module 'vue-router' {
2023-08-26 07:32:24 +08:00
interface RouteMeta extends RouteMetaCustom {}
2021-12-30 17:25:51 +08:00
}
type Component<T = any> =
| ReturnType<typeof defineComponent>
| (() => Promise<typeof import('*.vue')>)
| (() => Promise<T>)
declare global {
2023-09-25 16:10:30 +08:00
declare interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta' | 'children'> {
2021-12-30 17:25:51 +08:00
name: string
2023-08-26 07:32:24 +08:00
meta: RouteMetaCustom
2021-12-30 17:25:51 +08:00
component?: Component | string
children?: AppRouteRecordRaw[]
props?: Recordable
fullPath?: string
}
2022-02-19 20:34:44 +08:00
2023-09-25 16:10:30 +08:00
declare interface AppCustomRouteRecordRaw
extends Omit<RouteRecordRaw, 'meta' | 'component' | 'children'> {
2022-02-19 20:34:44 +08:00
name: string
2023-08-26 07:32:24 +08:00
meta: RouteMetaCustom
2022-02-19 20:34:44 +08:00
component: string
path: string
redirect: string
children?: AppCustomRouteRecordRaw[]
}
2021-12-30 17:25:51 +08:00
}