chore: 优化

This commit is contained in:
xiaojunnuo
2025-03-10 16:06:40 +08:00
parent 0c8a84656a
commit 0f5b9564c6
6 changed files with 43 additions and 59 deletions
@@ -48,6 +48,10 @@ function handleClick() {
if (props.disabled) {
return;
}
if (props.click) {
props.click();
return;
}
rootMenu?.handleMenuItemClick?.({
parentPaths: parentPaths.value,
path: props.path
@@ -40,14 +40,14 @@ const hasChildren = computed(() => {
:badge-variants="menu.badgeVariants"
:icon="menu.icon"
:path="menu.path"
@click="menu.meta?.onClick"
:click="menu.meta?.click"
>
<template #title>
<span>{{ menu.name }}</span>
</template>
<template v-if="menu.meta?.slot" #default>
<fs-render :render-func="menu.meta.slot" />
</template>
<template v-else #title>
<span>{{ menu.name }}</span>
</template>
</MenuItem>
<SubMenuComp v-else :key="`${menu.path}_sub`" :active-icon="menu.activeIcon" :icon="menu.icon" :path="menu.path">
<template #content>
@@ -1,6 +1,6 @@
import type { Component, Ref } from 'vue';
import type { Component, Ref } from "vue";
import type { MenuRecordBadgeRaw, ThemeModeType } from '/@/vben/typings';
import type { MenuRecordBadgeRaw, ThemeModeType } from "/@/vben/typings";
interface MenuProps {
/**
@@ -34,7 +34,7 @@ interface MenuProps {
* @zh_CN 菜单模式
* @default vertical
*/
mode?: 'horizontal' | 'vertical';
mode?: "horizontal" | "vertical";
/**
* @zh_CN 是否圆润风格
@@ -85,6 +85,7 @@ interface MenuItemProps extends MenuRecordBadgeRaw {
* @zh_CN menuitem 名称
*/
path: string;
click?: any;
}
interface MenuItemRegistered {
@@ -128,12 +129,4 @@ interface SubMenuProvider {
removeSubMenu: (item: MenuItemRegistered) => void;
}
export type {
MenuItemClicked,
MenuItemProps,
MenuItemRegistered,
MenuProps,
MenuProvider,
SubMenuProps,
SubMenuProvider,
};
export type { MenuItemClicked, MenuItemProps, MenuItemRegistered, MenuProps, MenuProvider, SubMenuProps, SubMenuProvider };