2017-03-05 20:02:53 +08:00
|
|
|
---
|
|
|
|
order: 6
|
2017-03-18 14:52:23 +08:00
|
|
|
iframe: 360
|
2017-03-05 20:02:53 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 固定头部
|
|
|
|
en-US: Fixed Header
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
一般用于固定顶部导航,方便页面切换。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Fixed Header is generally used to fix the top navigation to facilitate page switching.
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2017-03-05 20:02:53 +08:00
|
|
|
import { Layout, Menu, Breadcrumb } from 'antd';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2017-03-05 20:02:53 +08:00
|
|
|
const { Header, Content, Footer } = Layout;
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<Layout>
|
2018-05-29 23:31:21 +08:00
|
|
|
<Header style={{ position: 'fixed', zIndex: 1, width: '100%' }}>
|
2017-03-05 20:02:53 +08:00
|
|
|
<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>
|
2017-03-18 14:52:23 +08:00
|
|
|
<Content style={{ padding: '0 50px', marginTop: 64 }}>
|
2017-10-16 20:39:53 +08:00
|
|
|
<Breadcrumb style={{ margin: '16px 0' }}>
|
2017-03-05 20:02:53 +08:00
|
|
|
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
|
|
|
<Breadcrumb.Item>List</Breadcrumb.Item>
|
|
|
|
<Breadcrumb.Item>App</Breadcrumb.Item>
|
|
|
|
</Breadcrumb>
|
2017-03-18 14:52:23 +08:00
|
|
|
<div style={{ background: '#fff', padding: 24, minHeight: 380 }}>Content</div>
|
2017-03-05 20:02:53 +08:00
|
|
|
</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
|
|
|
```
|
2017-03-05 20:02:53 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```css
|
2017-03-05 20:02:53 +08:00
|
|
|
#components-layout-demo-fixed .logo {
|
|
|
|
width: 120px;
|
|
|
|
height: 31px;
|
2019-05-07 14:57:32 +08:00
|
|
|
background: rgba(255, 255, 255, 0.2);
|
2017-03-05 20:02:53 +08:00
|
|
|
margin: 16px 24px 16px 0;
|
|
|
|
float: left;
|
|
|
|
}
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|