2016-03-31 09:40:55 +08:00
---
order: 2
2017-01-23 11:08:46 +08:00
title:
zh-CN: 侧边导航
en-US: Aside
2016-03-31 09:40:55 +08:00
---
2015-11-09 19:40:35 +08:00
2017-01-23 11:08:46 +08:00
## zh-CN
2015-11-09 18:05:23 +08:00
顶级导航在侧边栏。
2015-11-14 21:08:43 +08:00
侧边导航在页面布局上采用的是左右的结构,一般主导航放置于页面的左侧固定位置,辅助菜单放置于工作区顶部。内容根据浏览器终端进行自适应,能提高横向空间的使用率,但是整个页面排版不稳定。侧边导航的模式层级扩展性强,一、二、三级导航项目可以更为顺畅且具关联性的被展示,同时侧边导航可以固定,使得用户在操作和浏览中可以快速的定位和切换当前位置,有很高的操作效率。但这类导航横向页面内容的空间会被牺牲一部份。
2017-01-23 11:08:46 +08:00
## en-US
Aside top level navigation
2017-01-25 21:10:51 +08:00
A left-right structure of page layouts is used to Aside navigation, Generally, the mainnav is placed on the left side of the page, and the secondary menu is placed on the top of the working area. Contents will adapt the layout to the viewing area to improve the horizontal space usage, while the layout of the whole page is not stable.
The level of the aisde navigation is scalable. The first, second, and third level navigations could be present more fluently and relevantly, and aside navigation can be fixed, allowing the user to quickly switch and spot the current position, improving the user experience. However, this navigation occupies some horizontal space of the contents.
2017-01-23 11:08:46 +08:00
2017-02-13 10:55:53 +08:00
````jsx
2015-11-14 20:41:10 +08:00
import { Menu, Breadcrumb, Icon } from 'antd';
2016-05-27 11:48:08 +08:00
import BrowserDemo from 'site/theme/template/BrowserDemo';
2015-11-14 20:41:10 +08:00
const SubMenu = Menu.SubMenu;
2015-11-09 19:40:35 +08:00
2015-11-09 18:05:23 +08:00
ReactDOM.render(
2015-11-09 21:00:30 +08:00
< BrowserDemo >
2016-12-23 17:58:37 +08:00
< div className = "layout-aside" >
< aside className = "layout-sider" >
< div className = "layout-logo" > < / div >
2015-11-14 20:41:10 +08:00
< Menu mode = "inline" theme = "dark"
defaultSelectedKeys={['1']} defaultOpenKeys={['sub1']}>
2017-01-23 11:08:46 +08:00
< SubMenu key = "sub1" title = {<span > < Icon type = "user" / > Navigation 1< / span > }>
< Menu.Item key = "1" > item 1< / Menu.Item >
< Menu.Item key = "2" > item 2< / Menu.Item >
< Menu.Item key = "3" > item 3< / Menu.Item >
< Menu.Item key = "4" > item 4< / Menu.Item >
2015-11-14 20:41:10 +08:00
< / SubMenu >
2017-01-23 11:08:46 +08:00
< SubMenu key = "sub2" title = {<span > < Icon type = "laptop" / > Navigation 2< / span > }>
< Menu.Item key = "5" > item 5< / Menu.Item >
< Menu.Item key = "6" > item 6< / Menu.Item >
< Menu.Item key = "7" > item 7< / Menu.Item >
< Menu.Item key = "8" > item 8< / Menu.Item >
2015-11-14 20:41:10 +08:00
< / SubMenu >
2017-01-23 11:08:46 +08:00
< SubMenu key = "sub3" title = {<span > < Icon type = "notification" / > Navigation 3< / span > }>
< Menu.Item key = "9" > item 9< / Menu.Item >
< Menu.Item key = "10" > item 10< / Menu.Item >
< Menu.Item key = "11" > item 11< / Menu.Item >
< Menu.Item key = "12" > item 12< / Menu.Item >
2015-11-14 20:41:10 +08:00
< / SubMenu >
< / Menu >
2015-11-09 21:00:30 +08:00
< / aside >
2016-12-23 17:58:37 +08:00
< div className = "layout-main" >
< div className = "layout-header" > < / div >
< div className = "layout-container" >
2015-11-14 20:41:10 +08:00
< Breadcrumb >
2017-01-23 11:08:46 +08:00
< Breadcrumb.Item > Home< / Breadcrumb.Item >
< Breadcrumb.Item > App list< / Breadcrumb.Item >
< Breadcrumb.Item > Any App< / Breadcrumb.Item >
2015-11-14 20:41:10 +08:00
< / Breadcrumb >
2016-12-23 17:58:37 +08:00
< div className = "layout-content" >
2015-12-28 13:56:10 +08:00
< div style = {{ height: 590 } } >
2017-01-23 11:08:46 +08:00
Contents
2015-12-28 13:56:10 +08:00
< / div >
2015-11-09 21:00:30 +08:00
< / div >
2015-11-09 19:40:35 +08:00
< / div >
2016-12-23 17:58:37 +08:00
< div className = "layout-footer" >
2017-01-23 11:08:46 +08:00
Ant Design all rights reserved © 2015 Created by Ant UED
2015-11-14 21:08:43 +08:00
< / div >
2015-11-09 19:40:35 +08:00
< / div >
< / div >
2015-11-09 21:00:30 +08:00
< / BrowserDemo >
2016-01-08 18:10:58 +08:00
, mountNode);
2015-11-09 18:05:23 +08:00
````
````css
2016-12-23 17:58:37 +08:00
.layout-aside {
2015-11-14 20:41:10 +08:00
position: relative;
min-height: 100%;
}
2016-12-23 17:58:37 +08:00
.layout-aside .layout-logo {
2015-11-14 20:41:10 +08:00
height: 32px;
background: #333 ;
2016-12-23 17:58:37 +08:00
border-radius: 4px;
margin: 16px 24px;
2015-11-09 19:40:35 +08:00
}
2016-12-23 17:58:37 +08:00
.layout-aside .layout-sider {
2015-11-09 19:40:35 +08:00
width: 224px;
2015-11-14 20:41:10 +08:00
background: #404040 ;
2015-11-09 19:40:35 +08:00
position: absolute;
2015-11-14 21:08:43 +08:00
overflow: auto;
2015-11-14 20:41:10 +08:00
padding-bottom: 24px;
2015-11-14 21:08:43 +08:00
height: 100%;
2015-11-14 20:41:10 +08:00
}
2016-12-23 17:58:37 +08:00
.layout-aside .layout-sider > .menu {
2015-11-14 20:41:10 +08:00
margin-bottom: 20px;
2015-11-09 19:40:35 +08:00
}
2016-12-23 17:58:37 +08:00
.layout-aside .layout-header {
2015-11-09 19:40:35 +08:00
background: #fff ;
height: 64px;
border-bottom: 1px solid #e9e9e9 ;
}
2016-12-23 17:58:37 +08:00
.layout-aside .layout-main {
2015-11-14 20:41:10 +08:00
margin-left: 224px;
2015-11-09 19:40:35 +08:00
}
2016-12-23 17:58:37 +08:00
.layout-aside .layout-container {
margin: 12px 16px 24px;
2015-11-09 19:40:35 +08:00
}
2016-12-23 17:58:37 +08:00
.layout-aside .layout-content {
2015-11-09 19:40:35 +08:00
background: #fff ;
2015-11-14 20:41:10 +08:00
padding: 24px;
2016-12-23 17:58:37 +08:00
margin-top: 12px;
border-radius: 4px;
2015-11-09 18:17:37 +08:00
}
2015-11-14 21:08:43 +08:00
2016-12-23 17:58:37 +08:00
.layout-aside .layout-footer {
2016-01-14 11:08:57 +08:00
height: 64px;
2015-11-14 21:12:02 +08:00
line-height: 64px;
2015-11-14 21:08:43 +08:00
text-align: center;
font-size: 12px;
color: #999 ;
background: #fff ;
border-top: 1px solid #e9e9e9 ;
width: 100%;
}
2015-11-09 18:17:37 +08:00
````