2019-01-09 20:38:09 +08:00
|
|
|
---
|
|
|
|
order: 2
|
|
|
|
title:
|
|
|
|
zh-CN: 在卡片中使用
|
|
|
|
en-US: In Card
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
在卡片中展示统计数值。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Display statistic data in Card.
|
|
|
|
|
|
|
|
```jsx
|
2019-08-13 14:07:17 +08:00
|
|
|
import { Statistic, Card, Row, Col } from 'antd';
|
2019-11-28 12:34:33 +08:00
|
|
|
import { ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons';
|
2019-01-09 20:38:09 +08:00
|
|
|
|
|
|
|
ReactDOM.render(
|
2019-12-24 20:58:42 +08:00
|
|
|
<div className="site-statistic-demo-card">
|
2019-01-09 20:38:09 +08:00
|
|
|
<Row gutter={16}>
|
|
|
|
<Col span={12}>
|
|
|
|
<Card>
|
|
|
|
<Statistic
|
|
|
|
title="Active"
|
|
|
|
value={11.28}
|
|
|
|
precision={2}
|
|
|
|
valueStyle={{ color: '#3f8600' }}
|
2019-11-28 12:34:33 +08:00
|
|
|
prefix={<ArrowUpOutlined />}
|
2019-01-09 20:38:09 +08:00
|
|
|
suffix="%"
|
|
|
|
/>
|
|
|
|
</Card>
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<Card>
|
|
|
|
<Statistic
|
|
|
|
title="Idle"
|
|
|
|
value={9.3}
|
|
|
|
precision={2}
|
|
|
|
valueStyle={{ color: '#cf1322' }}
|
2019-11-28 12:34:33 +08:00
|
|
|
prefix={<ArrowDownOutlined />}
|
2019-01-09 20:38:09 +08:00
|
|
|
suffix="%"
|
|
|
|
/>
|
|
|
|
</Card>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</div>,
|
2019-05-07 14:57:32 +08:00
|
|
|
mountNode,
|
2019-01-09 20:38:09 +08:00
|
|
|
);
|
|
|
|
```
|
2019-12-24 20:58:42 +08:00
|
|
|
|
|
|
|
```css
|
|
|
|
.site-statistic-demo-card {
|
|
|
|
padding: 30px;
|
2021-01-30 19:39:02 +08:00
|
|
|
background: #ececec;
|
2019-12-24 20:58:42 +08:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
<style>
|
|
|
|
[data-theme="dark"] .site-statistic-demo-card {
|
|
|
|
background: #303030;
|
|
|
|
}
|
|
|
|
</style>
|