graceCirProgress : /graceUI/组件目录/graceCirProgress
// canvasId 画布id 字符串类型 必填
canvasId:{type:String, 默认值:""},
// 画布宽和高 单位 px
width : {type : Number, 默认值: 200 },
// 圆环线条宽
lineWidth: { type: Number, 默认值: 10 },
// 圆环背景颜色
bgColor:{ type : String, 默认值: "#F1F1F1" },
progressColor:{ type: String, 默认值: "#00C777"},
// 进度条颜色
fontColor: { type: String, 默认值: "#00C777" },
// 进度值 [0 - 100]
value : { type : Number, 默认值: 0 },
// 百分百文字大小
fontSize : { type: Number, 默认值: 30 },
// 动画速度
speed : { type : Number, 默认值: 20 }uni-app 原生进度条组件使用说明见官方手册
https://uniapp.dcloud.io/component/progress
uni-app 平台下圆环进度条重要说明
因 uni-app 底层转换机制问题,canvas 无法使用动态id,我们使用 slot 完成了这个功能,所以组件的 canvasId 在使用时请务必设置;
演示代码
<template>
<gracePage :customHeader="false">
<view slot="gBody" class="grace-body">
<view class="grace-margin-top">
<text class="grace-title">进度圆环</text>
</view>
<view class="grace-space-between">
<view style='width:150px'>
<graceCirProgress :width="150" canvasId="graceCirProgress1" :value="val1" :lineWidth="20" progressColor="#10AEFF" fontColor="#10AEFF">
<canvas style="width:150px; height:150px;" canvas-id="graceCirProgress1"></canvas>
</graceCirProgress>
</view>
<view style='width:120px'>
<graceCirProgress :width="120" canvasId="graceCirProgress2" :value="60" :lineWidth="20" progressColor="#FF3500" fontColor="#FF3500">
<canvas style="width:120px; height:120px;" canvas-id="graceCirProgress2"></canvas>
</graceCirProgress>
</view>
</view>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/components/gracePage.vue";
import graceCirProgress from "../../graceUI/components/graceCirProgress.vue";
export default {
data() {
return {
val1 : 90,
val2 : 66
}
},
onLoad:function(){
setTimeout(function(){this.val1 = 20;}.bind(this), 2000);
},
methods: {},
components: {
gracePage, graceCirProgress
}
}
</script>
<style>
</style>