2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 0
|
2016-12-30 13:16:30 +08:00
|
|
|
title:
|
2016-08-26 14:42:41 +08:00
|
|
|
zh-CN: 顶部导航
|
|
|
|
en-US: Top Navigation
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-08-14 18:16:41 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-08-14 18:16:41 +08:00
|
|
|
水平的顶部导航菜单。
|
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Horizontal top navigation menu.
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2019-08-13 14:07:17 +08:00
|
|
|
import { Menu } from 'antd';
|
|
|
|
import { Mail, Appstore, Setting } from '@ant-design/icons';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2019-06-19 19:09:08 +08:00
|
|
|
const { SubMenu } = Menu;
|
2015-08-14 18:16:41 +08:00
|
|
|
|
2017-02-20 21:51:23 +08:00
|
|
|
class App extends React.Component {
|
|
|
|
state = {
|
|
|
|
current: 'mail',
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
handleClick = e => {
|
2015-08-15 00:07:40 +08:00
|
|
|
console.log('click ', e);
|
2015-08-14 18:16:41 +08:00
|
|
|
this.setState({
|
2016-05-06 18:07:23 +08:00
|
|
|
current: e.key,
|
2015-08-14 18:16:41 +08:00
|
|
|
});
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2015-08-14 18:16:41 +08:00
|
|
|
render() {
|
2015-11-14 17:29:48 +08:00
|
|
|
return (
|
2019-05-07 14:57:32 +08:00
|
|
|
<Menu onClick={this.handleClick} selectedKeys={[this.state.current]} mode="horizontal">
|
2015-11-14 17:29:48 +08:00
|
|
|
<Menu.Item key="mail">
|
2019-08-13 14:07:17 +08:00
|
|
|
<Mail />
|
2019-05-07 14:57:32 +08:00
|
|
|
Navigation One
|
2015-11-14 17:29:48 +08:00
|
|
|
</Menu.Item>
|
2015-12-04 11:22:16 +08:00
|
|
|
<Menu.Item key="app" disabled>
|
2019-08-13 14:07:17 +08:00
|
|
|
<Appstore />
|
2019-05-07 14:57:32 +08:00
|
|
|
Navigation Two
|
2015-11-14 17:29:48 +08:00
|
|
|
</Menu.Item>
|
2019-05-07 14:57:32 +08:00
|
|
|
<SubMenu
|
|
|
|
title={
|
|
|
|
<span className="submenu-title-wrapper">
|
2019-08-13 14:07:17 +08:00
|
|
|
<Setting />
|
2019-05-07 14:57:32 +08:00
|
|
|
Navigation Three - Submenu
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
>
|
2019-05-27 21:32:45 +08:00
|
|
|
<Menu.ItemGroup title="Item 1">
|
2016-09-22 10:40:42 +08:00
|
|
|
<Menu.Item key="setting:1">Option 1</Menu.Item>
|
|
|
|
<Menu.Item key="setting:2">Option 2</Menu.Item>
|
2019-05-27 21:32:45 +08:00
|
|
|
</Menu.ItemGroup>
|
|
|
|
<Menu.ItemGroup title="Item 2">
|
2016-09-22 10:40:42 +08:00
|
|
|
<Menu.Item key="setting:3">Option 3</Menu.Item>
|
|
|
|
<Menu.Item key="setting:4">Option 4</Menu.Item>
|
2019-05-27 21:32:45 +08:00
|
|
|
</Menu.ItemGroup>
|
2015-11-14 17:29:48 +08:00
|
|
|
</SubMenu>
|
|
|
|
<Menu.Item key="alipay">
|
2019-05-07 14:57:32 +08:00
|
|
|
<a href="https://ant.design" target="_blank" rel="noopener noreferrer">
|
|
|
|
Navigation Four - Link
|
|
|
|
</a>
|
2015-11-14 17:29:48 +08:00
|
|
|
</Menu.Item>
|
|
|
|
</Menu>
|
|
|
|
);
|
2017-02-20 21:51:23 +08:00
|
|
|
}
|
|
|
|
}
|
2015-08-14 18:16:41 +08:00
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
ReactDOM.render(<App />, mountNode);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|