Progress 进度条
uni-appH5微信小程序App
展示任务完成百分比的跨端进度条。
何时使用
展示耗时任务的进度:上传、下载、表单完成度。
何时不使用
无法量化进度时用 Loading;步骤型流程用 Tabs 或步骤条。
本文档为 uni-app 端组件契约;Web 端同名组件 API 可能略有差异,请以对应包文档为准。下方手机预览实时运行 uni-app H5 演示。
Props
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
percent | number | 0 | 0 到 100 的百分比 |
status | string:'normal' | 'success' | 'warning' | 'danger' | "normal" | 状态配色:normal 主色、success 成功、warning 警告、danger 危险 |
strokeWidth | number | 8 | 线条粗细(px) |
showText | boolean | true | 是否显示右侧百分比文字 |
striped | boolean | false | 斜纹填充 |
animated | boolean | false | 斜纹流动动画,需配合 striped |
示例
基础用法
vue
<Progress :percent="30" />
<Progress :percent="65" style="margin-top:12px" />
<Progress :percent="100" style="margin-top:12px" />状态配色
vue
<Progress :percent="45" status="normal" />
<Progress :percent="70" status="success" style="margin-top:12px" />
<Progress :percent="55" status="warning" style="margin-top:12px" />
<Progress :percent="90" status="danger" style="margin-top:12px" />粗细与文字
vue
<Progress :percent="60" :stroke-width="12" />
<Progress :percent="80" :show-text="false" style="margin-top:12px" />条纹动画
vue
<Progress :percent="66" striped animated />