diff --git a/.changeset/thick-news-joke.md b/.changeset/thick-news-joke.md new file mode 100644 index 000000000..7e664397d --- /dev/null +++ b/.changeset/thick-news-joke.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +Menu fix: 修复 mini 模式下子菜单内容展示不全问题 diff --git a/.changeset/wet-snails-cover.md b/.changeset/wet-snails-cover.md new file mode 100644 index 000000000..b5bcd47bb --- /dev/null +++ b/.changeset/wet-snails-cover.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/menu": patch +--- + +fix: 修复 mini 模式下子菜单内容展示不全问题 diff --git a/packages/ui/menu/src/Menu.tsx b/packages/ui/menu/src/Menu.tsx index 50bbf7aea..586790d15 100644 --- a/packages/ui/menu/src/Menu.tsx +++ b/packages/ui/menu/src/Menu.tsx @@ -227,6 +227,18 @@ export const Menu = forwardRef( ) } + const renderItem = useCallback( + (menuItem: MenuDataItem, level?: number) => { + // 显示缩略内容 + if (showMini && level === 1) { + return renderMenuItemMini(menuItem) + } + + return isFunction(render) ? render(menuItem, level) : menuItem.title + }, + [render, showMini] + ) + const cls = cx( prefixCls, className, @@ -260,19 +272,13 @@ export const Menu = forwardRef( {mergedTagList.map((item, index) => { return showMini ? ( - + ) : (