Progress 进度条

优质
小牛编辑
116浏览
2023-12-01

用于展示操作进度,告知用户当前状态和预期。

线形进度条 — 百分比外显

[percentage] 属性是必填的,表示进度条对应的百分比。

<el-progress [percentage]="0"></el-progress>
<el-progress [percentage]="70"></el-progress>
<el-progress [percentage]="100" status="success"></el-progress>
<el-progress [percentage]="50" status="exception"></el-progress>

线形进度条 — 百分比内显

百分比不占用额外控件,适用于文件上传等场景。

可通过 stroke-width 属性更改进度条的高度,并可通过 text-inside 属性来将进度条描述置于进度条内部

<el-progress [text-inside]="true" [stroke-width]="18" [percentage]="0"></el-progress>
<el-progress [text-inside]="true" [stroke-width]="18" [percentage]="70"></el-progress>
<el-progress [text-inside]="true" [stroke-width]="18" [percentage]="100" status="success"></el-progress>
<el-progress [text-inside]="true" [stroke-width]="18" [percentage]="50" status="exception"></el-progress>

环形进度条

可通过 type 属性来指定使用环形进度条

<el-progress type="circle" [percentage]="0"></el-progress>
<el-progress type="circle" [percentage]="25"></el-progress>
<el-progress type="circle" [percentage]="100" status="success"></el-progress>
<el-progress type="circle" [percentage]="50" status="exception"></el-progress>

Progress Attributes

参数说明类型可选值默认值
percentage百分比(必填number0-1000
type进度条类型stringline/circleline
stroke-width进度条的宽度,单位 pxnumber6
text-inside进度条显示文字内置在进度条内(只在 type=line 时可用)boolean
status进度条当前状态stringsuccess/exception
width环形进度条画布宽度(只在 type=circle 时可用)number126
show-text是否显示进度条文字内容boolean1
active-color自定义进度条激活时的背景颜色 (只在 type=line 时可用)string