2019-01-09 20:38:09 +08:00
|
|
|
---
|
|
|
|
category: Components
|
|
|
|
subtitle: 统计数值
|
2022-11-09 12:28:04 +08:00
|
|
|
group: 数据展示
|
2019-01-09 20:38:09 +08:00
|
|
|
title: Statistic
|
2022-11-30 20:14:41 +08:00
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*YL7PRYNtH-4AAAAAAAAAAAAADrJ8AQ/original
|
2023-02-09 22:17:31 +08:00
|
|
|
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*BPWDRbSYxJ4AAAAAAAAAAAAADrJ8AQ/original
|
2022-11-09 12:28:04 +08:00
|
|
|
demo:
|
|
|
|
cols: 2
|
2019-01-09 20:38:09 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
展示统计数值。
|
|
|
|
|
|
|
|
## 何时使用
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
- 当需要突出某个或某组数字时。
|
|
|
|
- 当需要展示带描述的统计类数据时使用。
|
2019-01-09 20:38:09 +08:00
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
## 代码演示
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
<!-- prettier-ignore -->
|
2022-11-09 12:28:04 +08:00
|
|
|
<code src="./demo/basic.tsx">基本</code>
|
|
|
|
<code src="./demo/unit.tsx">单位</code>
|
2023-01-05 14:07:33 +08:00
|
|
|
<code src="./demo/animated.tsx">动画效果</code>
|
2023-01-05 15:30:59 +08:00
|
|
|
<code src="./demo/card.tsx" background="grey">在卡片中使用</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
<code src="./demo/countdown.tsx">倒计时</code>
|
2023-05-09 19:24:50 +08:00
|
|
|
<code src="./demo/component-token.tsx" debug>组件 Token</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
2019-01-09 20:38:09 +08:00
|
|
|
## API
|
|
|
|
|
|
|
|
#### Statistic
|
|
|
|
|
2022-06-24 16:39:21 +08:00
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
| ---------------- | ------------------ | -------------------- | ------ | ----- |
|
|
|
|
| decimalSeparator | 设置小数点 | string | `.` | |
|
|
|
|
| formatter | 自定义数值展示 | (value) => ReactNode | - | |
|
|
|
|
| groupSeparator | 设置千分位标识符 | string | `,` | |
|
|
|
|
| loading | 数值是否加载中 | boolean | false | 4.8.0 |
|
|
|
|
| precision | 数值精度 | number | - | |
|
|
|
|
| prefix | 设置数值的前缀 | ReactNode | - | |
|
|
|
|
| suffix | 设置数值的后缀 | ReactNode | - | |
|
|
|
|
| title | 数值的标题 | ReactNode | - | |
|
|
|
|
| value | 数值内容 | string \| number | - | |
|
|
|
|
| valueStyle | 设置数值区域的样式 | CSSProperties | - | |
|
2019-01-09 20:38:09 +08:00
|
|
|
|
|
|
|
#### Statistic.Countdown
|
|
|
|
|
2019-07-11 14:14:33 +08:00
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
| --- | --- | --- | --- | --- |
|
2022-06-13 14:03:43 +08:00
|
|
|
| format | 格式化倒计时展示,参考 [dayjs](https://day.js.org/) | string | `HH:mm:ss` | |
|
2020-10-09 10:08:52 +08:00
|
|
|
| prefix | 设置数值的前缀 | ReactNode | - | |
|
|
|
|
| suffix | 设置数值的后缀 | ReactNode | - | |
|
|
|
|
| title | 数值的标题 | ReactNode | - | |
|
2022-06-13 14:03:43 +08:00
|
|
|
| value | 数值内容 | number \| dayjs | - | |
|
2022-06-24 16:39:21 +08:00
|
|
|
| valueStyle | 设置数值区域的样式 | CSSProperties | - | |
|
2020-10-21 10:33:43 +08:00
|
|
|
| onFinish | 倒计时完成时触发 | () => void | - | |
|
2021-05-24 16:24:00 +08:00
|
|
|
| onChange | 倒计时时间变化时触发 | (value: number) => void | - | 4.16.0 |
|
2023-04-11 10:25:24 +08:00
|
|
|
|
|
|
|
## Design Token
|
|
|
|
|
|
|
|
<ComponentTokenTable component="Statistic"></ComponentTokenTable>
|