Skip to main content

Dropdown

将动作或菜单折叠到下拉菜单中

基础用法​

function App() {
const [visible, setVisible] = useState(false)
return (
<div className="ykui-demo-row">
<Dropdown
visible={visible}
onVisibleChange={(val) => setVisible(val)}
trigger="click"
usePortalWrapper={false}
overlay={
<div className="overlay">
<div>h1111111</div>
<div>h1111111</div>
</div>
}
>
<a href="#" onClick={(e) => e.preventDefault()}>click me</a>
</Dropdown>
</div>
);
}
属性说明类型默认值
placement显示的位置placementEnumbottom
visible是否显示booleanfalse
container指定挂载的dom,默认为bodyany--
trigger触发方式hover〡click〡focushover
overlay显示的组件Function〡ReactElement<any>--
style样式Object--
onHide面板关闭时调用Function--
operationButtons排除click outside的按钮any[]--
onVisibleChange显示或者隐藏的时候调用Function--
mouseEnterDelay显示弹窗延迟number--
mouseLeaveDelay关闭弹窗延迟numberleft
children触发的元素ReactElement<any>--
autoFixedScroll自动监听滚动条滚动booleantrue
fixedWidthpanel宽度与trigger的宽度一致booleantrue

placementEnum​

placementEnum 的取值:
'bottomLeft' | 'bottom' | 'bottomRight' | 'topLeft' | 'top' | 'topRight' | 'left' | 'leftTop'
| 'leftBottom' | 'right' | 'rightTop' | 'rightBottom' | 'auto'