xys-FTA-Ui/types/router.d.ts

82 lines
2.8 KiB
TypeScript
Raw Normal View History

2024-04-28 08:45:18 +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: '/home'
followAuth: '/home'
canTo: true true即使hidden为true( false)
}
**/
declare module 'vue-router' {
interface RouteMeta extends Record<string | number | symbol, unknown> {
hidden?: boolean
alwaysShow?: boolean
title?: string
icon?: string
noCache?: boolean
breadcrumb?: boolean
affix?: boolean
activeMenu?: string
noTagsView?: boolean
followAuth?: string
canTo?: boolean
}
}
type Component<T = any> =
| ReturnType<typeof defineComponent>
| (() => Promise<typeof import('*.vue')>)
| (() => Promise<T>)
declare global {
interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
name: string
meta: RouteMeta
component?: Component | string
children?: AppRouteRecordRaw[]
props?: Recordable
fullPath?: string
keepAlive?: boolean
}
interface AppCustomRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
icon: any
name: string
meta: RouteMeta
component: string
componentName?: string
path: string
redirect: string
children?: AppCustomRouteRecordRaw[]
keepAlive?: boolean
visible?: boolean
parentId?: number
alwaysShow?: boolean
}
}