admin-vue3/types/router.d.ts

82 lines
2.8 KiB
TypeScript
Raw Normal View History

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使hiddentrue( 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 {
2023-04-03 08:11:12 +00:00
interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
name: string
meta: RouteMeta
component?: Component | string
children?: AppRouteRecordRaw[]
props?: Recordable
fullPath?: string
keepAlive?: boolean
}
2023-04-03 08:11:12 +00:00
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
}
}