fix: should limit submenu height (#2227)

This commit is contained in:
被雨水过滤的空气-Rairn 2023-07-11 14:47:27 +08:00 committed by GitHub
parent 2e8c14e0d6
commit 1fb15de29a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -58,6 +58,7 @@ SchemaInitializer.Button = observer(
const [searchValue, setSearchValue] = useState('');
const [isPending, startTransition] = useTransition();
const menuItems = useRef([]);
const { styles } = useStyles();
const changeMenu = (v: boolean) => {
// 这里是为了防止当鼠标快速滑过时,终止菜单的渲染,防止卡顿
@ -155,6 +156,7 @@ SchemaInitializer.Button = observer(
key: item.key || `item-group-${indexA}`,
label,
title: label,
popupClassName: styles.nbMenuItemGroup,
children: renderItems(item.children),
}
);

View File

@ -1,10 +1,12 @@
import { createStyles } from 'antd-style';
export const useStyles = createStyles(() => {
export const useStyles = createStyles(({ token }) => {
return {
nbMenuItemGroup: {
maxHeight: '50vh',
overflow: 'auto',
overflowY: 'auto',
boxShadow: token.boxShadowSecondary,
borderRadius: token.borderRadiusLG,
},
};
});