2020-11-20 13:41:58 +08:00
|
|
|
---
|
|
|
|
order: 999
|
|
|
|
title:
|
|
|
|
zh-CN: 自定义 label & wrapper 样式
|
|
|
|
en-US: Customize label & wrapper style
|
|
|
|
debug: true
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
自定义 label & wrapper 样式
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Customize label & wrapper style
|
|
|
|
|
|
|
|
```tsx
|
2020-12-30 17:08:43 +08:00
|
|
|
import { Descriptions, Divider } from 'antd';
|
2020-11-20 13:41:58 +08:00
|
|
|
|
|
|
|
const labelStyle: React.CSSProperties = { background: 'red' };
|
|
|
|
const contentStyle: React.CSSProperties = { background: 'green' };
|
|
|
|
|
2020-12-30 17:08:43 +08:00
|
|
|
function renderCelledDesc(bordered?: boolean) {
|
|
|
|
return (
|
|
|
|
<Descriptions title="User Info" bordered={bordered}>
|
2020-11-20 13:41:58 +08:00
|
|
|
<Descriptions.Item label="Product" labelStyle={labelStyle} contentStyle={contentStyle}>
|
|
|
|
Cloud Database
|
|
|
|
</Descriptions.Item>
|
|
|
|
<Descriptions.Item label="Billing Mode">Prepaid</Descriptions.Item>
|
|
|
|
<Descriptions.Item label="Automatic Renewal">YES</Descriptions.Item>
|
|
|
|
</Descriptions>
|
2020-12-30 17:08:43 +08:00
|
|
|
);
|
|
|
|
}
|
2020-11-20 13:41:58 +08:00
|
|
|
|
2020-12-30 17:08:43 +08:00
|
|
|
function renderRootDesc(bordered?: boolean) {
|
|
|
|
return (
|
|
|
|
<Descriptions
|
|
|
|
title="Root style"
|
|
|
|
labelStyle={labelStyle}
|
|
|
|
contentStyle={contentStyle}
|
|
|
|
bordered={bordered}
|
|
|
|
>
|
|
|
|
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
|
2020-11-20 13:41:58 +08:00
|
|
|
<Descriptions.Item label="Billing Mode">Prepaid</Descriptions.Item>
|
2020-12-30 17:08:43 +08:00
|
|
|
<Descriptions.Item
|
|
|
|
label="Automatic Renewal"
|
|
|
|
labelStyle={{ color: 'orange' }}
|
|
|
|
contentStyle={{ color: 'blue' }}
|
|
|
|
>
|
|
|
|
YES
|
|
|
|
</Descriptions.Item>
|
2020-11-20 13:41:58 +08:00
|
|
|
</Descriptions>
|
2020-12-30 17:08:43 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<>
|
|
|
|
{renderCelledDesc()}
|
|
|
|
{renderCelledDesc(true)}
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
|
|
|
{renderRootDesc()}
|
|
|
|
{renderRootDesc(true)}
|
2020-11-20 13:41:58 +08:00
|
|
|
</>,
|
|
|
|
mountNode,
|
|
|
|
);
|
|
|
|
```
|