2016-03-31 14:17:09 +08:00
|
|
|
|
---
|
|
|
|
|
category: Components
|
2016-09-21 11:28:38 +08:00
|
|
|
|
subtitle: 进度条
|
2022-11-09 12:28:04 +08:00
|
|
|
|
group: 反馈
|
2016-09-21 11:28:38 +08:00
|
|
|
|
title: Progress
|
2022-11-30 20:14:41 +08:00
|
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*gK_4S6fDRfgAAAAAAAAAAAAADrJ8AQ/original
|
2023-02-09 22:17:31 +08:00
|
|
|
|
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*HJH8Tb1lcYAAAAAAAAAAAAAADrJ8AQ/original
|
2022-11-09 12:28:04 +08:00
|
|
|
|
demo:
|
|
|
|
|
cols: 2
|
2016-03-31 14:17:09 +08:00
|
|
|
|
---
|
2015-05-27 15:43:29 +08:00
|
|
|
|
|
2015-06-15 14:43:27 +08:00
|
|
|
|
展示操作的当前进度。
|
2015-05-27 15:43:29 +08:00
|
|
|
|
|
2015-06-15 14:43:27 +08:00
|
|
|
|
## 何时使用
|
2015-05-27 15:43:29 +08:00
|
|
|
|
|
2015-06-19 10:42:49 +08:00
|
|
|
|
在操作需要较长时间才能完成时,为用户显示该操作的当前进度和状态。
|
2015-06-18 11:25:38 +08:00
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
|
- 当一个操作会打断当前界面,或者需要在后台运行,且耗时可能超过 2 秒时;
|
2016-07-26 15:42:04 +08:00
|
|
|
|
- 当需要显示一个操作完成的百分比时。
|
2015-06-18 11:25:38 +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/line.tsx">进度条</code>
|
|
|
|
|
<code src="./demo/circle.tsx">进度圈</code>
|
|
|
|
|
<code src="./demo/line-mini.tsx">小型进度条</code>
|
|
|
|
|
<code src="./demo/circle-micro.tsx">响应式进度圈</code>
|
|
|
|
|
<code src="./demo/circle-mini.tsx">小型进度圈</code>
|
|
|
|
|
<code src="./demo/dynamic.tsx">动态展示</code>
|
|
|
|
|
<code src="./demo/format.tsx">自定义文字格式</code>
|
|
|
|
|
<code src="./demo/dashboard.tsx">仪表盘</code>
|
|
|
|
|
<code src="./demo/segment.tsx">分段进度条</code>
|
|
|
|
|
<code src="./demo/linecap.tsx">边缘形状</code>
|
|
|
|
|
<code src="./demo/gradient-line.tsx">自定义进度条渐变色</code>
|
|
|
|
|
<code src="./demo/steps.tsx">步骤进度条</code>
|
2023-03-01 11:49:42 +08:00
|
|
|
|
<code src="./demo/size.tsx">尺寸</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
2016-04-05 16:55:52 +08:00
|
|
|
|
## API
|
2015-07-29 23:36:27 +08:00
|
|
|
|
|
2023-08-08 18:27:48 +08:00
|
|
|
|
通用属性参考:[通用属性](/docs/react/common-props)
|
|
|
|
|
|
2019-01-29 15:23:23 +08:00
|
|
|
|
各类型共用的属性。
|
|
|
|
|
|
2023-03-01 11:49:42 +08:00
|
|
|
|
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
|
| format | 内容的模板函数 | function(percent, successPercent) | (percent) => percent + `%` | - |
|
|
|
|
|
| percent | 百分比 | number | 0 | - |
|
|
|
|
|
| showInfo | 是否显示进度数值或状态图标 | boolean | true | - |
|
|
|
|
|
| status | 状态,可选:`success` `exception` `normal` `active`(仅限 line) | string | - | - |
|
|
|
|
|
| strokeColor | 进度条的色彩 | string | - | - |
|
|
|
|
|
| strokeLinecap | 进度条的样式 | `round` \| `butt` \| `square`,区别详见 [stroke-linecap](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) | `round` | - |
|
|
|
|
|
| success | 成功进度条相关配置 | { percent: number, strokeColor: string } | - | - |
|
|
|
|
|
| trailColor | 未完成的分段的颜色 | string | - | - |
|
|
|
|
|
| type | 类型,可选 `line` `circle` `dashboard` | string | `line` | - |
|
2023-06-20 22:08:25 +08:00
|
|
|
|
| size | 进度条的尺寸 | number \| \[number \| string, number] \| "small" \| "default" | "default" | v5.3.0 |
|
2019-01-29 15:23:23 +08:00
|
|
|
|
|
|
|
|
|
### `type="line"`
|
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
|
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
|
| steps | 进度条总共步数 | number | - | - |
|
|
|
|
|
| strokeColor | 进度条的色彩,传入 object 时为渐变。当有 `steps` 时支持传入一个数组。 | string \| string[] \| { from: string; to: string; direction: string } | - | 4.21.0: `string[]` |
|
2019-01-29 15:23:23 +08:00
|
|
|
|
|
|
|
|
|
### `type="circle"`
|
|
|
|
|
|
2023-03-01 11:49:42 +08:00
|
|
|
|
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
2023-08-25 00:28:38 +08:00
|
|
|
|
| strokeColor | 圆形进度条线的色彩,传入 object 时为渐变 | string \| { number%: string } | - | - |
|
2023-03-01 11:49:42 +08:00
|
|
|
|
| strokeWidth | 圆形进度条线的宽度,单位是进度条画布宽度的百分比 | number | 6 | - |
|
2019-01-29 15:23:23 +08:00
|
|
|
|
|
|
|
|
|
### `type="dashboard"`
|
|
|
|
|
|
2023-03-01 11:49:42 +08:00
|
|
|
|
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
|
| gapDegree | 仪表盘进度条缺口角度,可取值 0 ~ 295 | number | 75 | - |
|
|
|
|
|
| gapPosition | 仪表盘进度条缺口位置 | `top` \| `bottom` \| `left` \| `right` | `bottom` | - |
|
|
|
|
|
| strokeWidth | 仪表盘进度条线的宽度,单位是进度条画布宽度的百分比 | number | 6 | - |
|
2023-04-11 10:25:24 +08:00
|
|
|
|
|
2023-08-30 23:02:35 +08:00
|
|
|
|
## 主题变量(Design Token)
|
2023-04-11 10:25:24 +08:00
|
|
|
|
|
|
|
|
|
<ComponentTokenTable component="Progress"></ComponentTokenTable>
|