ProgressCircle (环形进度条)
环形进度条组件是一个可定制的UI组件,用于显示圆形进度指示,支持自定义线条宽度、颜色,并可显示进度百分比。
支持平台
安卓 | ios | 鸿蒙 | web | 微信小程序 |
---|---|---|---|---|
√ | √ | √ | √ | √ |
示例代码
html
<template>
<t-page>
<t-card title="ProgressCircle 环形进度条" main-class="mlrt-30"
sub-title="环形进度条组件是一个可定制的UI组件,用于显示圆形进度指示,支持自定义线条宽度、颜色,并可显示进度百分比。"></t-card>
<introduction title="操作">
<t-button type="p" main-class="mb-15" @click="add">增加</t-button>
<t-button type="e" @click="reduce">减少</t-button>
</introduction>
<introduction title="基础使用+主题展示" v-if="area==1">
<t-row>
<t-progress-circle main-class="mb-30 twh-150 mr-20" v-model="progress" type="e"></t-progress-circle>
<t-progress-circle main-class="mb-30 twh-150 mr-20" v-model="progress" type="p"></t-progress-circle>
<t-progress-circle main-class="mb-30 twh-150 mr-20" v-model="progress" type="s"></t-progress-circle>
<t-progress-circle main-class="mb-30 twh-150 mr-20" v-model="progress" type="w"></t-progress-circle>
</t-row>
</introduction>
<introduction title="设置大小背景颜色" v-if="area==2">
<t-progress-circle v-model="progress" main-class="twh-200" type="p" inactiveColor="#00aaff"
activeColor="#ffaa00" lineWidth="20rpx"></t-progress-circle>
</introduction>
<introduction title="显示百分比" v-if="area==3">
<t-progress-circle :showLabel="true" v-model="progress" type="p" inactiveColor="#ff5500"
activeColor="#ff007f" lineWidth="10rpx"></t-progress-circle>
</introduction>
<t-row main-class='fww tdb tdr tdp mltr-30'>
<t-button type="p" main-class="mrb-30" size="small" @click="area=1">基础使用+主题展示</t-button>
<t-button type="e" main-class="mrb-30" size="small" @click="area=2">设置大小背景颜色</t-button>
<t-button type="s" main-class="mrb-30" size="small" @click="area=3">显示百分比</t-button>
</t-row>
</t-page>
</template>
<script setup>
const area = ref(1)
const progress = ref(55)
function add() {
let p = progress.value + 10
if (p > 100) p = 100
progress.value = p
}
function reduce() {
let p = progress.value - 10
if (p < 0) p = 0
progress.value = p
}
</script>
属性
名称 | 类型 | 默认值 | 说明 | 可选值 |
---|---|---|---|---|
size | String | mini | 组件尺寸 | large(大尺寸), medium(中尺寸), small(小尺寸), mini(迷你) |
type | String | "" | 组件类型 | info(信息), primary(正常), error(错误), warning(警告), success(成功) |
disabled | Boolean | false | 组件是否禁用 | false, true |
stop | Boolean | false | 是否阻止事件冒泡(Tui统一写法处理事件冒泡) | false, true |
hover | Boolean | true | 是否有点击效果 | false, true |
path | String | "" | 点击组件后跳转的页面路径,如果为空则响应点击事件,如果不为空则跳转页面不会响应单击事件。 | - |
mainClass | String | "" | 组件根节点的样式 | - |
nativeClass | String | "" | 组件根节点原生样式 | - |
effect | String | "normal" | 组件显示主题 | normal(正常), dark(深色), light(浅色), plain(镂空) |
unit | String | % | 进度条值的单位 | |
inactiveColor | String | #ececec | 进度条未激活时的颜色 | |
activeColor | String | `` | 进度条激活时的颜色 | |
showLabel | Boolean | false | 是否显示进度标签 | |
lineWidth | String | 20rpx | 进度条线条宽度 | |
duration | Number | 300 | 进度条过渡的持续时间,单位为毫秒 | |
modelValue | Number | 1 | 双向绑定的值 |