<circle-progress :id="1" :width="200" :radius="20" :progress="70" :delay="200" :duration="1000" :barColor="#F2AE57" :backgroundColor="#FFE8CC" :isAnimation="true" :timeFunction="cubic-bezier(0.99, 0.01, 0.22, 0.94)" >
| 参数名 | 值类型 | 是否必填 | 参数做用 | 默认值 |
| :------: | :------: | :------: | :------: | :------: |
| id | String | 选填 | 组件的id,屡次定义设置不一样的值 | 1 |
| width | Number | 必填 | 设置圆总体的大小,单位为px | 无 |
| radius | Number | 必填 | 设置进度条宽度,单位为px | 无 |
| progress | Number | 必填 | 设置进度百分比 | 无 |
| barColor | String | 必填 | 设置进度条颜色 | 无 |
| backgroundColor | String | 必填 | 设置进度条背景颜色 | 无 |
| delay | Number | 选填 | 延迟多久执行,单位为ms | 20 |
| duration | Number | 选填 | 动画总体时长,单位为ms | 1000 |
| timeFunction | String | 选填 | 动画缓动算法 | cubic-bezier(0.99, 0.01, 0.22, 0.94) |
| isAnimation | Boolean | 选填 | 是否以动画的方式呈现 | true |css
fill:填充的图案或者颜色,因为这里直接使用画笔描绘图形,因此用不上,为了覆盖其默认值black,设置为none前端
<circle ref="$bar" :r="(width-radius)/2" :cy="width/2" :cx="width/2" :stroke="barColor" :stroke-width="radius" :stroke-linecap="isRound ? 'round' : 'square'" :stroke-dasharray="(width-radius)*3.14" :stroke-dashoffset="isAnimation ? (width-radius) * 3.14 : (width - radius) * 3.14 * (100 - progress) / 100" fill="none" />
stroke-dashoffset除了在节点属性中设置,也能够经过css样式设置vue
@keyframes circle_progress_keyframes_name_1 { from { stroke-dashoffset: 565.2px; } to { stroke-dashoffset: 169.56px; } } .circle_progress_bar1 { animation: circle_progress_keyframes_name_1 1000ms 20ms cubic-bezier(0.99, 0.01, 0.22, 0.94) forwards; }
这波组件较为简单,貌似没什么可说的了,就这样吧css3