Jac*_*chi 8 css drop-down-menu reactjs antd
我正在Dropdown
使用 Ant Design 制作菜单:
import React, { Component } from "react";
import { Icon, Dropdown, Menu } from "antd";
const { Item } = Menu;
class NotificationBell extends Component {
render() {
const menu = (
<Menu>
<Item><p>You must be connected to get notifications.</p></Item>
</Menu>
);
return (
<Dropdown overlay={menu} trigger={['click']}>
<Icon type="bell" theme="outlined" />
</Dropdown>
);
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我得到的:
但我不想只删除突出显示,我还想让组件不可点击,即我想要一个“普通光标”而不是“手形光标”。
按照Ant Design 文档的selectable={false}
建议在组件上添加prop没有帮助。我应该怎么办?Menu
感谢您的帮助。
小智 5
CSS 属性pointer-events
设置为none
使组件忽略鼠标事件而不改变光标的样式。
<Menu>
<Menu.Item key="/">
<Link href="/">Clickable</Link>
</Menu.Item>
<Menu.Item style={{ pointerEvents: 'none' }}>
Unclickable
</Menu.Item>
</Menu>here
Run Code Online (Sandbox Code Playgroud)