FlowBL/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即使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 {
declare interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
name: string
meta: RouteMeta
component?: Component | string
children?: AppRouteRecordRaw[]
props?: Recordable
fullPath?: string
keepAlive?: boolean
}
declare 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
}
}