fix: type `Component` is not assignable to `RouteMeta` (#4140)

* fix: type `Component` is not assignable to `RouteMeta`

* fix: ci fail
pull/48/MERGE
Li Kui 2024-08-13 21:30:14 +08:00 committed by GitHub
parent 738bc456c8
commit 1a4d61cc17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 28 deletions

View File

@ -1,5 +1,7 @@
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import type { Component } from 'vue';
/** /**
* *
*/ */
@ -44,7 +46,7 @@ interface MenuRecordRaw extends MenuRecordBadgeRaw {
/** /**
* *
*/ */
icon?: string; icon?: Component | string;
/** /**
* *
*/ */

View File

@ -68,7 +68,7 @@ interface RouteMeta {
/** /**
* /tab * /tab
*/ */
icon?: string; icon?: Component | string;
/** /**
* iframe * iframe
*/ */

View File

@ -1,6 +1,6 @@
import type { MenuRecordBadgeRaw, ThemeModeType } from '@vben-core/typings'; import type { MenuRecordBadgeRaw, ThemeModeType } from '@vben-core/typings';
import type { Ref } from 'vue'; import type { Component, Ref } from 'vue';
interface MenuProps { interface MenuProps {
/** /**
@ -61,7 +61,7 @@ interface SubMenuProps extends MenuRecordBadgeRaw {
/** /**
* @zh_CN * @zh_CN
*/ */
icon?: string; icon?: Component | string;
/** /**
* @zh_CN submenu * @zh_CN submenu
*/ */
@ -80,7 +80,7 @@ interface MenuItemProps extends MenuRecordBadgeRaw {
/** /**
* @zh_CN * @zh_CN
*/ */
icon?: string; icon?: Component | string;
/** /**
* @zh_CN menuitem * @zh_CN menuitem
*/ */
@ -93,10 +93,6 @@ interface MenuItemRegistered {
path: string; path: string;
} }
// export interface MenuItemClicked {
// name: string;
// }
interface MenuItemClicked { interface MenuItemClicked {
parentPaths: string[]; parentPaths: string[];
path: string; path: string;

View File

@ -31,12 +31,6 @@ const hasChildren = computed(() => {
Reflect.has(menu, 'children') && !!menu.children && menu.children.length > 0 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> </script>
<template> <template>

View File

@ -1,5 +1,7 @@
import type { Component } from 'vue';
interface IBreadcrumb { interface IBreadcrumb {
icon?: string; icon?: Component | string;
isHome?: boolean; isHome?: boolean;
items?: IBreadcrumb[]; items?: IBreadcrumb[];
path?: string; path?: string;

View File

@ -30,11 +30,7 @@ const breadcrumbs = computed((): IBreadcrumb[] => {
const resultBreadcrumb: IBreadcrumb[] = []; const resultBreadcrumb: IBreadcrumb[] = [];
for (const match of matched) { for (const match of matched) {
const { const { meta, path } = match;
meta,
path,
// children = []
} = match;
const { hideChildrenInMenu, hideInBreadcrumb, icon, name, title } = const { hideChildrenInMenu, hideInBreadcrumb, icon, name, title } =
meta || {}; meta || {};
if (hideInBreadcrumb || hideChildrenInMenu || !path) { if (hideInBreadcrumb || hideChildrenInMenu || !path) {
@ -45,13 +41,6 @@ const breadcrumbs = computed((): IBreadcrumb[] => {
icon, icon,
path: path || route.path, path: path || route.path,
title: title ? $t((title || name) as string) : '', 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) { if (props.showHome) {