mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-13 15:49:10 +08:00
64b905e9bd
* update icons deps * update all icon ref * fix lint * update snapshot
74 lines
1.6 KiB
Markdown
Executable File
74 lines
1.6 KiB
Markdown
Executable File
---
|
|
order: 0
|
|
title:
|
|
zh-CN: 顶部导航
|
|
en-US: Top Navigation
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
水平的顶部导航菜单。
|
|
|
|
## en-US
|
|
|
|
Horizontal top navigation menu.
|
|
|
|
```jsx
|
|
import { Menu } from 'antd';
|
|
import { MailOutlined, AppstoreOutlined, SettingOutlined } from '@ant-design/icons';
|
|
|
|
const { SubMenu } = Menu;
|
|
|
|
class App extends React.Component {
|
|
state = {
|
|
current: 'mail',
|
|
};
|
|
|
|
handleClick = e => {
|
|
console.log('click ', e);
|
|
this.setState({
|
|
current: e.key,
|
|
});
|
|
};
|
|
|
|
render() {
|
|
return (
|
|
<Menu onClick={this.handleClick} selectedKeys={[this.state.current]} mode="horizontal">
|
|
<Menu.Item key="mail">
|
|
<MailOutlined />
|
|
Navigation One
|
|
</Menu.Item>
|
|
<Menu.Item key="app" disabled>
|
|
<AppstoreOutlined />
|
|
Navigation Two
|
|
</Menu.Item>
|
|
<SubMenu
|
|
title={
|
|
<span className="submenu-title-wrapper">
|
|
<SettingOutlined />
|
|
Navigation Three - Submenu
|
|
</span>
|
|
}
|
|
>
|
|
<Menu.ItemGroup title="Item 1">
|
|
<Menu.Item key="setting:1">Option 1</Menu.Item>
|
|
<Menu.Item key="setting:2">Option 2</Menu.Item>
|
|
</Menu.ItemGroup>
|
|
<Menu.ItemGroup title="Item 2">
|
|
<Menu.Item key="setting:3">Option 3</Menu.Item>
|
|
<Menu.Item key="setting:4">Option 4</Menu.Item>
|
|
</Menu.ItemGroup>
|
|
</SubMenu>
|
|
<Menu.Item key="alipay">
|
|
<a href="https://ant.design" target="_blank" rel="noopener noreferrer">
|
|
Navigation Four - Link
|
|
</a>
|
|
</Menu.Item>
|
|
</Menu>
|
|
);
|
|
}
|
|
}
|
|
|
|
ReactDOM.render(<App />, mountNode);
|
|
```
|