t-progress-line
ProgressLine 线形进度
组件介绍
线型进度条组件可以直观地展示进度百分比,适用于多种场景,如加载指示器、任务完成度展示等。
平台兼容
| Harmony | H5 | Android | iOS | 小程序 | UTS |
|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
基础用法
vue
<template>
<view class="progress-demo">
<t-progress-line :percent="30"></t-progress-line>
<t-progress-line :percent="60" :showPercentage="true"></t-progress-line>
<t-progress-line :percent="90" type="primary" :showPercentage="true"></t-progress-line>
<t-progress-line :percent="75" activeColor="#ff6b6b" :showPercentage="true"></t-progress-line>
</view>
</template>
<style scoped>
.progress-demo {
padding: 40rpx;
display: flex;
flex-direction: column;
gap: 30rpx;
}
</style>Props
| 属性名 | 类型 | 默认值 | 说明 | 可选值 |
|---|---|---|---|---|
| size | String | "medium" | 组件尺寸 | large, medium, small, mini |
| type | String | "" | 组件类型 | info, primary, error, warning, success |
| disabled | Boolean | false | 组件是否禁用 | true, false |
| hover | Boolean | false | 是否有点击效果 | true, false |
| path | String | "" | 点击组件后跳转的页面路径 | - |
| effect | String | "normal" | 组件显示主题 | normal, dark, light, plain |
| percent | Number | 0 | 进度条的当前百分比 | 0-100 |
| showPercentage | Boolean | false | 是否显示进度百分比 | true, false |
| activeColor | String | "" | 进度条激活时的颜色 | - |
Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| click | 点击时触发 | - |
| transitionend | 动画结束时触发 | - |
| initFinished | 组件初始化完成触发 | 组件的节点信息 |
| touchstart | 触摸开始时触发 | 触摸事件对象 |
| touchend | 触摸结束时触发 | 触摸事件对象 |
| touchmove | 触摸移动时触发 | 触摸事件对象 |
| touchcancel | 触摸取消时触发 | 触摸事件对象 |