2016-12-30 21:41:28 +08:00
|
|
|
---
|
|
|
|
order: 2
|
|
|
|
title:
|
|
|
|
zh-CN: 顶部-侧边布局
|
|
|
|
en-US: Header-Sider
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2017-02-27 23:39:16 +08:00
|
|
|
拥有顶部导航及侧边栏的页面,多用于展示类网站。
|
2016-12-30 21:41:28 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2017-02-27 23:39:16 +08:00
|
|
|
Both the top navigation and the sidebar, commonly used in documentation site.
|
2016-12-30 21:41:28 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
|
|
|
import { Layout, Menu, Breadcrumb, Icon } from 'antd';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2016-12-30 21:41:28 +08:00
|
|
|
const { SubMenu } = Menu;
|
2019-05-07 14:57:32 +08:00
|
|
|
const { Header, Content, Footer, Sider } = Layout;
|
2016-12-30 21:41:28 +08:00
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<Layout>
|
|
|
|
<Header className="header">
|
|
|
|
<div className="logo" />
|
|
|
|
<Menu
|
|
|
|
theme="dark"
|
|
|
|
mode="horizontal"
|
|
|
|
defaultSelectedKeys={['2']}
|
|
|
|
style={{ lineHeight: '64px' }}
|
|
|
|
>
|
|
|
|
<Menu.Item key="1">nav 1</Menu.Item>
|
|
|
|
<Menu.Item key="2">nav 2</Menu.Item>
|
|
|
|
<Menu.Item key="3">nav 3</Menu.Item>
|
|
|
|
</Menu>
|
|
|
|
</Header>
|
|
|
|
<Content style={{ padding: '0 50px' }}>
|
2017-10-16 20:39:53 +08:00
|
|
|
<Breadcrumb style={{ margin: '16px 0' }}>
|
2016-12-30 21:41:28 +08:00
|
|
|
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
|
|
|
<Breadcrumb.Item>List</Breadcrumb.Item>
|
|
|
|
<Breadcrumb.Item>App</Breadcrumb.Item>
|
|
|
|
</Breadcrumb>
|
|
|
|
<Layout style={{ padding: '24px 0', background: '#fff' }}>
|
2017-01-20 20:09:59 +08:00
|
|
|
<Sider width={200} style={{ background: '#fff' }}>
|
2016-12-30 21:41:28 +08:00
|
|
|
<Menu
|
|
|
|
mode="inline"
|
|
|
|
defaultSelectedKeys={['1']}
|
|
|
|
defaultOpenKeys={['sub1']}
|
2017-01-20 20:09:59 +08:00
|
|
|
style={{ height: '100%' }}
|
2016-12-30 21:41:28 +08:00
|
|
|
>
|
2019-05-07 14:57:32 +08:00
|
|
|
<SubMenu
|
|
|
|
key="sub1"
|
|
|
|
title={
|
|
|
|
<span>
|
|
|
|
<Icon type="user" />
|
|
|
|
subnav 1
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
>
|
2016-12-30 21:41:28 +08:00
|
|
|
<Menu.Item key="1">option1</Menu.Item>
|
|
|
|
<Menu.Item key="2">option2</Menu.Item>
|
|
|
|
<Menu.Item key="3">option3</Menu.Item>
|
|
|
|
<Menu.Item key="4">option4</Menu.Item>
|
|
|
|
</SubMenu>
|
2019-05-07 14:57:32 +08:00
|
|
|
<SubMenu
|
|
|
|
key="sub2"
|
|
|
|
title={
|
|
|
|
<span>
|
|
|
|
<Icon type="laptop" />
|
|
|
|
subnav 2
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
>
|
2016-12-30 21:41:28 +08:00
|
|
|
<Menu.Item key="5">option5</Menu.Item>
|
|
|
|
<Menu.Item key="6">option6</Menu.Item>
|
|
|
|
<Menu.Item key="7">option7</Menu.Item>
|
|
|
|
<Menu.Item key="8">option8</Menu.Item>
|
|
|
|
</SubMenu>
|
2019-05-07 14:57:32 +08:00
|
|
|
<SubMenu
|
|
|
|
key="sub3"
|
|
|
|
title={
|
|
|
|
<span>
|
|
|
|
<Icon type="notification" />
|
|
|
|
subnav 3
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
>
|
2016-12-30 21:41:28 +08:00
|
|
|
<Menu.Item key="9">option9</Menu.Item>
|
|
|
|
<Menu.Item key="10">option10</Menu.Item>
|
|
|
|
<Menu.Item key="11">option11</Menu.Item>
|
|
|
|
<Menu.Item key="12">option12</Menu.Item>
|
|
|
|
</SubMenu>
|
|
|
|
</Menu>
|
|
|
|
</Sider>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Content style={{ padding: '0 24px', minHeight: 280 }}>Content</Content>
|
2016-12-30 21:41:28 +08:00
|
|
|
</Layout>
|
|
|
|
</Content>
|
2019-05-07 14:57:32 +08:00
|
|
|
<Footer style={{ textAlign: 'center' }}>Ant Design ©2018 Created by Ant UED</Footer>
|
2018-06-27 15:55:04 +08:00
|
|
|
</Layout>,
|
2019-05-07 14:57:32 +08:00
|
|
|
mountNode,
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2016-12-30 21:41:28 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```css
|
2016-12-30 21:41:28 +08:00
|
|
|
#components-layout-demo-top-side .logo {
|
|
|
|
width: 120px;
|
|
|
|
height: 31px;
|
2019-05-07 14:57:32 +08:00
|
|
|
background: rgba(255, 255, 255, 0.2);
|
2016-12-30 21:41:28 +08:00
|
|
|
margin: 16px 28px 16px 0;
|
|
|
|
float: left;
|
|
|
|
}
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|