2015-08-14 18:16:41 +08:00
|
|
|
# 顶部导航
|
|
|
|
|
|
|
|
- order: 0
|
|
|
|
|
|
|
|
水平的顶部导航菜单。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var Menu = antd.Menu;
|
|
|
|
var SubMenu = Menu.SubMenu;
|
2015-10-02 15:26:18 +08:00
|
|
|
var Icon = antd.Icon;
|
2015-08-14 18:16:41 +08:00
|
|
|
|
|
|
|
var App = React.createClass({
|
|
|
|
getInitialState() {
|
|
|
|
return {
|
|
|
|
current: 'mail'
|
|
|
|
}
|
|
|
|
},
|
2015-08-15 00:07:40 +08:00
|
|
|
handleClick(e) {
|
|
|
|
console.log('click ', e);
|
2015-08-14 18:16:41 +08:00
|
|
|
this.setState({
|
2015-08-15 00:07:40 +08:00
|
|
|
current: e.key
|
2015-08-14 18:16:41 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
return <Menu onClick={this.handleClick} selectedKeys={[this.state.current]} mode="horizontal">
|
|
|
|
<Menu.Item key="mail">
|
2015-10-02 15:26:18 +08:00
|
|
|
<Icon type="mail" />导航一
|
2015-08-14 18:16:41 +08:00
|
|
|
</Menu.Item>
|
|
|
|
<Menu.Item key="app">
|
2015-10-02 15:26:18 +08:00
|
|
|
<Icon type="appstore" />导航二
|
2015-08-14 18:16:41 +08:00
|
|
|
</Menu.Item>
|
2015-10-02 15:26:18 +08:00
|
|
|
<SubMenu title={<span><Icon type="setting" />导航 - 子菜单</span>}>
|
2015-08-14 18:16:41 +08:00
|
|
|
<Menu.Item key="setting:1">选项1</Menu.Item>
|
|
|
|
<Menu.Item key="setting:2">选项2</Menu.Item>
|
|
|
|
<Menu.Item key="setting:3">选项3</Menu.Item>
|
|
|
|
<Menu.Item key="setting:4">选项4</Menu.Item>
|
|
|
|
</SubMenu>
|
2015-08-17 17:28:48 +08:00
|
|
|
<Menu.Item key="alipay">
|
|
|
|
<a href="http://www.alipay.com/" target="_blank">导航四 - 链接</a>
|
|
|
|
</Menu.Item>
|
2015-08-14 18:16:41 +08:00
|
|
|
</Menu>
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-10-20 16:47:55 +08:00
|
|
|
ReactDOM.render(<App />, document.getElementById('components-menu-demo-horizontal'));
|
2015-08-14 18:16:41 +08:00
|
|
|
````
|