mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-09-15 08:25:10 +08:00
fix 修复 选择图标时tooltip显示后滚动出现错位现象
This commit is contained in:
parent
e80b187810
commit
682b931931
@ -71,6 +71,8 @@ const iconOptions: Array<[string, IconComponent]> = [
|
|||||||
['ai', RobotOutlined]
|
['ai', RobotOutlined]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const getIconTooltipContainer = (triggerNode: HTMLElement) => triggerNode.parentElement ?? document.body;
|
||||||
|
|
||||||
export interface IconSelectProps {
|
export interface IconSelectProps {
|
||||||
value?: string;
|
value?: string;
|
||||||
onChange?: (value: string) => void;
|
onChange?: (value: string) => void;
|
||||||
@ -125,7 +127,13 @@ export default function IconSelect({ value, onChange, width = '100%' }: IconSele
|
|||||||
<div className="icon-select-list-react">
|
<div className="icon-select-list-react">
|
||||||
{matchedIcons.map(([name, Icon]) => {
|
{matchedIcons.map(([name, Icon]) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip key={name} title={name}>
|
<Tooltip
|
||||||
|
key={name}
|
||||||
|
title={name}
|
||||||
|
placement="bottom"
|
||||||
|
getPopupContainer={getIconTooltipContainer}
|
||||||
|
styles={{ root: { pointerEvents: 'none' } }}
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`icon-select-item-react${value === name ? ' active' : ''}`}
|
className={`icon-select-item-react${value === name ? ' active' : ''}`}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user