更新记录

1.0.1(2025-03-20) 下载此版本

  • 更新使用文档
  • 优化部分参数

1.0.0(2025-03-20) 下载此版本

[v1.0.0] - 2025-03-20

发布半圆进度条

  • 支持自定义颜色包括渐变色
  • 支持rpx单位

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
app-vue × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序 鸿蒙元服务
× × × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari

ProgressCircle 圆形进度条组件

基于 Canvas 实现的动态圆形进度条组件,支持渐变色、自定义尺寸及末端圆点样式。

特性

  • 🎨 支持线性/径向渐变色进度条
  • ⚙️ 自定义进度条宽度、颜色、尺寸
  • 🔵 智能端点颜色适配
  • 📱 自适应 rpx/px 单位
  • 🖥 跨平台兼容(支持 UniApp 环境)

使用方法

<!-- 1. 基础使用 -->
<l-progress-circle :percent="18" bg-color="#D2DBE1" progress-color="#f93d2f" width="134rpx" height="67rpx" />
<!-- 2. 线性渐变 -->
<l-progress-circle
  index="1"
  :strokeWidth="6"
  :percent="28"
  bg-color="#D2DBE1"
  :progress-color="{
      type: 'linear', // 可省略
      colors: [
        { offset: 0, color: '#ee7da2' },
        { offset: 1, color: '#a60525' }
      ]
    }"
  width="180rpx"
/>
<!-- 3. 径向渐变 -->
<l-progress-circle
  index="2"
  :strokeWidth="6"
  :percent="50"
  bg-color="#D2DBE1"
  :progress-color="{
       type: 'radial',
       colors: [
         { offset: 0, color: '#8847ff' },
         { offset: 1, color: '#6f7ca8' }
       ]
     }"
  width="180rpx"
/>
<!-- 4. 自定义内容 -->
<l-progress-circle index="3" :strokeWidth="8" :percent="88" progress-color="#3ba422" width="280rpx">
  <view class="text">
    <view>88/100</view>
    <view>合格数/总数</view>
  </view>
</l-progress-circle>

Props 配置项

参数名 类型 默认值 必填 说明 验证规则
percent Number, String 0 进度百分比(0-100) 必须 ≥0 且 ≤100
strokeWidth Number 4 进度条宽度(单位:px)
bgColor String '#eeeeee' 背景轨道颜色 必须是有效颜色值
progressColor String, Object '#19be6b' 进度条颜色(支持线性/径向渐变) 渐变需传入对象,详见下表
dotColor String - 末端圆点颜色(默认取 progressColor,如果是渐变默认取 progressColor 最后一个色值)
width Number, String 200 画布宽度(支持 rpx/px/无单位数值) 支持 CSS 单位转换
height Number, String width/2 画布高度(默认取宽度的一半) 同 width 单位规则
index Number, String 0 画布唯一标识后缀(用于同一页面多个实例)

progressColor 渐变对象

参数名 类型 默认值 必填 说明
type String linear 渐变类型(linear/radial)
start Array [0, '50%'] 渐变起始坐标([ x 坐标, y 坐标 ])
end Array ['100%', '50%'] 渐变结束坐标([ x 坐标, y 坐标 ])
colors Array - 渐变颜色节点对象 {offset, color} offset 为 0 到 1
radius Number width/2 径向渐变的半径长度

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问