Browse Source
fix: type `Component` is not assignable to `RouteMeta` (#4140)
* fix: type `Component` is not assignable to `RouteMeta`
* fix: ci fail
pull/4143/head
Li Kui
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with
11 additions and
28 deletions
-
packages/@core/base/typings/src/menu-record.ts
-
packages/@core/base/typings/src/vue-router.d.ts
-
packages/@core/ui-kit/menu-ui/src/interface/index.ts
-
packages/@core/ui-kit/menu-ui/src/sub-menu.vue
-
packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/types.ts
-
packages/effects/layouts/src/widgets/breadcrumb.vue
|
|
|
@ -1,5 +1,7 @@ |
|
|
|
import type { RouteRecordRaw } from 'vue-router'; |
|
|
|
|
|
|
|
import type { Component } from 'vue'; |
|
|
|
|
|
|
|
/** |
|
|
|
* 扩展路由原始对象 |
|
|
|
*/ |
|
|
|
@ -44,7 +46,7 @@ interface MenuRecordRaw extends MenuRecordBadgeRaw { |
|
|
|
/** |
|
|
|
* 图标名 |
|
|
|
*/ |
|
|
|
icon?: string; |
|
|
|
icon?: Component | string; |
|
|
|
/** |
|
|
|
* 菜单名 |
|
|
|
*/ |
|
|
|
|
|
|
|
@ -68,7 +68,7 @@ interface RouteMeta { |
|
|
|
/** |
|
|
|
* 图标(菜单/tab) |
|
|
|
*/ |
|
|
|
icon?: string; |
|
|
|
icon?: Component | string; |
|
|
|
/** |
|
|
|
* iframe 地址 |
|
|
|
*/ |
|
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import type { MenuRecordBadgeRaw, ThemeModeType } from '@vben-core/typings'; |
|
|
|
|
|
|
|
import type { Ref } from 'vue'; |
|
|
|
import type { Component, Ref } from 'vue'; |
|
|
|
|
|
|
|
interface MenuProps { |
|
|
|
/** |
|
|
|
@ -61,7 +61,7 @@ interface SubMenuProps extends MenuRecordBadgeRaw { |
|
|
|
/** |
|
|
|
* @zh_CN 图标 |
|
|
|
*/ |
|
|
|
icon?: string; |
|
|
|
icon?: Component | string; |
|
|
|
/** |
|
|
|
* @zh_CN submenu 名称 |
|
|
|
*/ |
|
|
|
@ -80,7 +80,7 @@ interface MenuItemProps extends MenuRecordBadgeRaw { |
|
|
|
/** |
|
|
|
* @zh_CN 图标 |
|
|
|
*/ |
|
|
|
icon?: string; |
|
|
|
icon?: Component | string; |
|
|
|
/** |
|
|
|
* @zh_CN menuitem 名称 |
|
|
|
*/ |
|
|
|
@ -93,10 +93,6 @@ interface MenuItemRegistered { |
|
|
|
path: string; |
|
|
|
} |
|
|
|
|
|
|
|
// export interface MenuItemClicked {
|
|
|
|
// name: string;
|
|
|
|
// }
|
|
|
|
|
|
|
|
interface MenuItemClicked { |
|
|
|
parentPaths: string[]; |
|
|
|
path: string; |
|
|
|
|
|
|
|
@ -31,12 +31,6 @@ const hasChildren = computed(() => { |
|
|
|
Reflect.has(menu, 'children') && !!menu.children && menu.children.length > 0 |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
// function menuIcon(menu: MenuRecordRaw) { |
|
|
|
// return props.activePath === menu.path |
|
|
|
// ? menu.activeIcon || menu.icon |
|
|
|
// : menu.icon; |
|
|
|
// } |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
|
|
|
|
@ -1,5 +1,7 @@ |
|
|
|
import type { Component } from 'vue'; |
|
|
|
|
|
|
|
interface IBreadcrumb { |
|
|
|
icon?: string; |
|
|
|
icon?: Component | string; |
|
|
|
isHome?: boolean; |
|
|
|
items?: IBreadcrumb[]; |
|
|
|
path?: string; |
|
|
|
|
|
|
|
@ -30,11 +30,7 @@ const breadcrumbs = computed((): IBreadcrumb[] => { |
|
|
|
const resultBreadcrumb: IBreadcrumb[] = []; |
|
|
|
|
|
|
|
for (const match of matched) { |
|
|
|
const { |
|
|
|
meta, |
|
|
|
path, |
|
|
|
// children = [] |
|
|
|
} = match; |
|
|
|
const { meta, path } = match; |
|
|
|
const { hideChildrenInMenu, hideInBreadcrumb, icon, name, title } = |
|
|
|
meta || {}; |
|
|
|
if (hideInBreadcrumb || hideChildrenInMenu || !path) { |
|
|
|
@ -45,13 +41,6 @@ const breadcrumbs = computed((): IBreadcrumb[] => { |
|
|
|
icon, |
|
|
|
path: path || route.path, |
|
|
|
title: title ? $t((title || name) as string) : '', |
|
|
|
// items: children.map((child) => { |
|
|
|
// return { |
|
|
|
// icon: child?.meta?.icon as string, |
|
|
|
// path: child.path, |
|
|
|
// title: child?.meta?.title as string, |
|
|
|
// }; |
|
|
|
// }), |
|
|
|
}); |
|
|
|
} |
|
|
|
if (props.showHome) { |
|
|
|
|