2015-06-09 13:46:47 +08:00
|
|
|
# 基本
|
|
|
|
|
2015-06-10 17:12:03 +08:00
|
|
|
- order: 3
|
2015-06-09 13:46:47 +08:00
|
|
|
|
|
|
|
点击菜单项后会触发事件,用户可以通过相应的菜单项 key 进行不同的操作。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var Menu = antd.Menu;
|
|
|
|
var Dropdown = antd.Dropdown;
|
2015-08-10 17:57:28 +08:00
|
|
|
var onClick = function ({key}){
|
2015-06-09 13:46:47 +08:00
|
|
|
alert('选中了菜单' + key);
|
2015-06-09 18:08:56 +08:00
|
|
|
};
|
2015-06-09 13:46:47 +08:00
|
|
|
|
|
|
|
var menu = <Menu onClick={onClick}>
|
|
|
|
<Menu.Item key="1">第一个菜单项</Menu.Item>
|
|
|
|
<Menu.Item key="2">第二个菜单项</Menu.Item>
|
|
|
|
<Menu.Item key="3">第三个菜单项</Menu.Item>
|
|
|
|
</Menu>;
|
|
|
|
|
|
|
|
React.render(
|
|
|
|
<Dropdown overlay={menu}>
|
2015-06-17 14:44:24 +08:00
|
|
|
<button className="ant-btn ant-btn-menu">
|
2015-06-15 17:36:10 +08:00
|
|
|
鼠标移入,点击菜单 <i className="anticon anticon-down"></i>
|
2015-06-09 13:46:47 +08:00
|
|
|
</button>
|
|
|
|
</Dropdown>
|
|
|
|
, document.getElementById('components-dropdown-demo-event'));
|
|
|
|
````
|