2019-03-02 15:51:08 +08:00
|
|
|
---
|
2019-10-15 11:46:12 +08:00
|
|
|
order: 4
|
2019-03-02 15:51:08 +08:00
|
|
|
title:
|
2019-08-25 15:38:51 +08:00
|
|
|
zh-CN: 组合示例
|
|
|
|
en-US: Complete example
|
2019-03-02 15:51:08 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2020-03-09 17:52:29 +08:00
|
|
|
使用了 PageHeader 提供的所有能力。
|
2019-03-02 15:51:08 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2020-03-09 17:52:29 +08:00
|
|
|
Show all props provided by PageHeader.
|
2019-03-02 15:51:08 +08:00
|
|
|
|
|
|
|
```jsx
|
2019-09-04 17:06:55 +08:00
|
|
|
import { PageHeader, Menu, Dropdown, Button, Tag, Typography, Row } from 'antd';
|
2019-11-28 12:34:33 +08:00
|
|
|
import { EllipsisOutlined } from '@ant-design/icons';
|
2019-03-02 15:51:08 +08:00
|
|
|
|
|
|
|
const { Paragraph } = Typography;
|
|
|
|
|
2019-08-25 15:38:51 +08:00
|
|
|
const menu = (
|
|
|
|
<Menu>
|
|
|
|
<Menu.Item>
|
|
|
|
<a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">
|
|
|
|
1st menu item
|
|
|
|
</a>
|
|
|
|
</Menu.Item>
|
|
|
|
<Menu.Item>
|
|
|
|
<a target="_blank" rel="noopener noreferrer" href="http://www.taobao.com/">
|
|
|
|
2nd menu item
|
|
|
|
</a>
|
|
|
|
</Menu.Item>
|
|
|
|
<Menu.Item>
|
|
|
|
<a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
|
|
|
|
3rd menu item
|
|
|
|
</a>
|
|
|
|
</Menu.Item>
|
|
|
|
</Menu>
|
|
|
|
);
|
|
|
|
|
|
|
|
const DropdownMenu = () => {
|
|
|
|
return (
|
|
|
|
<Dropdown key="more" overlay={menu}>
|
|
|
|
<Button
|
|
|
|
style={{
|
|
|
|
border: 'none',
|
|
|
|
padding: 0,
|
|
|
|
}}
|
|
|
|
>
|
2019-11-28 12:34:33 +08:00
|
|
|
<EllipsisOutlined
|
2019-08-25 15:38:51 +08:00
|
|
|
style={{
|
|
|
|
fontSize: 20,
|
|
|
|
verticalAlign: 'top',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</Button>
|
|
|
|
</Dropdown>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-03-02 15:51:08 +08:00
|
|
|
const routes = [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
breadcrumbName: 'First-level Menu',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'first',
|
|
|
|
breadcrumbName: 'Second-level Menu',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'second',
|
|
|
|
breadcrumbName: 'Third-level Menu',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-08-25 15:38:51 +08:00
|
|
|
const IconLink = ({ src, text }) => (
|
2020-03-18 20:26:42 +08:00
|
|
|
<a className="example-link">
|
|
|
|
<img className="example-link-icon" src={src} alt={text} />
|
2019-08-25 15:38:51 +08:00
|
|
|
{text}
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
|
2019-03-02 15:51:08 +08:00
|
|
|
const content = (
|
2020-03-09 17:52:29 +08:00
|
|
|
<>
|
2019-03-02 15:51:08 +08:00
|
|
|
<Paragraph>
|
2019-05-07 14:57:32 +08:00
|
|
|
Ant Design interprets the color system into two levels: a system-level color system and a
|
|
|
|
product-level color system.
|
2019-03-02 15:51:08 +08:00
|
|
|
</Paragraph>
|
|
|
|
<Paragraph>
|
2019-05-07 14:57:32 +08:00
|
|
|
Ant Design's design team preferred to design with the HSB color model, which makes it
|
|
|
|
easier for designers to have a clear psychological expectation of color when adjusting colors,
|
|
|
|
as well as facilitate communication in teams.
|
2019-03-02 15:51:08 +08:00
|
|
|
</Paragraph>
|
2020-03-09 17:52:29 +08:00
|
|
|
<div>
|
2019-08-25 15:38:51 +08:00
|
|
|
<IconLink
|
|
|
|
src="https://gw.alipayobjects.com/zos/rmsportal/MjEImQtenlyueSmVEfUD.svg"
|
|
|
|
text="Quick Start"
|
|
|
|
/>
|
|
|
|
<IconLink
|
|
|
|
src="https://gw.alipayobjects.com/zos/rmsportal/NbuDUAuBlIApFuDvWiND.svg"
|
|
|
|
text=" Product Info"
|
|
|
|
/>
|
|
|
|
<IconLink
|
|
|
|
src="https://gw.alipayobjects.com/zos/rmsportal/ohOEPSYdDTNnyMbGuyLb.svg"
|
|
|
|
text="Product Doc"
|
|
|
|
/>
|
2020-03-09 17:52:29 +08:00
|
|
|
</div>
|
|
|
|
</>
|
2019-03-02 15:51:08 +08:00
|
|
|
);
|
|
|
|
|
2019-08-25 15:38:51 +08:00
|
|
|
const Content = ({ children, extraContent }) => {
|
|
|
|
return (
|
2020-03-09 17:52:29 +08:00
|
|
|
<Row>
|
|
|
|
<div style={{ flex: 1 }}>{children}</div>
|
|
|
|
<div className="image">{extraContent}</div>
|
2019-08-25 15:38:51 +08:00
|
|
|
</Row>
|
|
|
|
);
|
|
|
|
};
|
2019-03-02 15:51:08 +08:00
|
|
|
|
|
|
|
ReactDOM.render(
|
2019-08-25 15:38:51 +08:00
|
|
|
<PageHeader
|
|
|
|
title="Title"
|
2019-12-23 18:36:49 +08:00
|
|
|
className="site-page-header"
|
2019-08-25 15:38:51 +08:00
|
|
|
subTitle="This is a subtitle"
|
|
|
|
tags={<Tag color="blue">Running</Tag>}
|
|
|
|
extra={[
|
|
|
|
<Button key="3">Operation</Button>,
|
|
|
|
<Button key="2">Operation</Button>,
|
|
|
|
<Button key="1" type="primary">
|
|
|
|
Primary
|
|
|
|
</Button>,
|
|
|
|
<DropdownMenu key="more" />,
|
|
|
|
]}
|
|
|
|
avatar={{ src: 'https://avatars1.githubusercontent.com/u/8186664?s=460&v=4' }}
|
|
|
|
breadcrumb={{ routes }}
|
|
|
|
>
|
|
|
|
<Content
|
|
|
|
extraContent={
|
|
|
|
<img
|
2020-01-09 15:28:52 +08:00
|
|
|
src="https://gw.alipayobjects.com/zos/antfincdn/K%24NnlsB%26hz/pageHeader.svg"
|
2019-08-25 15:38:51 +08:00
|
|
|
alt="content"
|
2020-03-09 17:52:29 +08:00
|
|
|
width="100%"
|
2019-08-25 15:38:51 +08:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{content}
|
|
|
|
</Content>
|
2019-03-02 15:51:08 +08:00
|
|
|
</PageHeader>,
|
|
|
|
mountNode,
|
|
|
|
);
|
|
|
|
```
|
2020-03-09 17:52:29 +08:00
|
|
|
|
|
|
|
```css
|
|
|
|
#components-page-header-demo-content .image {
|
|
|
|
margin: 0 0 0 60px;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
2020-04-20 16:50:38 +08:00
|
|
|
#components-page-header-demo-content .ant-page-header-rtl .image {
|
|
|
|
margin: 0 60px 0 0;
|
|
|
|
}
|
|
|
|
|
2020-03-18 20:26:42 +08:00
|
|
|
#components-page-header-demo-content .example-link {
|
2020-04-28 11:16:01 +08:00
|
|
|
line-height: 24px;
|
2020-03-18 20:26:42 +08:00
|
|
|
margin-right: 16px;
|
|
|
|
}
|
2020-04-28 11:16:01 +08:00
|
|
|
[data-theme='compact'] #components-page-header-demo-content .example-link {
|
|
|
|
line-height: 20px;
|
|
|
|
}
|
2020-03-18 20:26:42 +08:00
|
|
|
#components-page-header-demo-content .example-link-icon {
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
|
2020-04-28 11:16:01 +08:00
|
|
|
[data-theme='compact'] #components-page-header-demo-content .example-link-icon {
|
|
|
|
width: 20px;
|
|
|
|
height: 20px;
|
|
|
|
}
|
|
|
|
|
2020-03-18 20:26:42 +08:00
|
|
|
#components-page-header-demo-content .ant-page-header-rtl .example-link {
|
|
|
|
float: right;
|
|
|
|
margin-right: 0;
|
|
|
|
margin-left: 16px;
|
|
|
|
}
|
|
|
|
#components-page-header-demo-content .ant-page-header-rtl .example-link-icon {
|
|
|
|
margin-right: 0;
|
|
|
|
margin-left: 8px;
|
|
|
|
}
|
|
|
|
|
2020-03-09 17:52:29 +08:00
|
|
|
@media (max-width: 768px) {
|
|
|
|
#components-page-header-demo-content .image {
|
|
|
|
flex: 100%;
|
|
|
|
margin: 24px 0 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|