TuProgress 进度条
percent / showText / textInside / strokeWidth / color,宽度 0.3s 过渡,无事件。
进度条:percent 越界自动收敛到 0–100,宽度变化带 0.3s 过渡。纯受控展示组件,无自定义事件。
属性
| 名称 | 类型 | 说明 |
|---|---|---|
percent | number | 进度 0–100(越界自动收敛),默认 0。 |
showText | boolean | 显示百分比文字,默认 true。 |
textInside | boolean | 文字置于进度条内部(右侧),默认 false。 |
strokeWidth | number | 进度条高度(px),默认 8。 |
color | string | 进度条颜色,默认 var(--tu-primary)。 |
trackColor | string | 轨道颜色,默认 var(--tu-border)。 |
30%
当前进度 30% —— 进度由父级维护,点击按钮更新 percent。
实例
ts
createComponent({
component: TuProgress,
props: { percent: this.state.uploaded, textInside: true, strokeWidth: 10 },
})