Skip to content

Commit

Permalink
UPDATE README
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaszhu committed May 18, 2020
1 parent 6ebd1a1 commit bbe270e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ mprogress.draw(60);
...
<canvas class="canvas" canvas-id="progress"></canvas>
```
## 显示模式
|效果|解析|
|:----|:-----|
|![正常模式](/assets/images/params.png)|正常模式(默认)|
|![百分比模式](/assets/images/percent.png)|百分比模式(只需要按需求传入percent即可,相见参数说明)|

## 参数说明
![图解参数](/assets/images/params.png)

|参数名|数据类型|解析|必要参数|示列|
|:----|:-----|:-----|:---:|:-----|
|canvasId|String|页面canvas的id||progress|
|canvasSize|Object|canvas画布的大小,对应单位是rpx,只需要传入数字即可||{width: 200, height: 300}|
|percent|Number|默认按照360度去计算和显示圆环,如果传入80%则会自动根据canvas尺寸贴底画出最大半圆弧,有效值在50%~100%||100|
|barStyle|Array|圆弧进度样式,按照数组元素的位置顺序渲染,一般第一个元素配置是铺满整个圆弧的底色,第二个元素配置是按照进度百分比渲染圆弧。fillStyle可以是是普通颜色和渐变颜色,使用渐变颜色是需要按照数组的格式传入各个点的位置和颜色信息||[{width: 12, fillStyle: '#f0f0f0'}, {width: 12, fillStyle: [{position: 0, color: '#56B37F'}, {position: 1, color: '#c0e674'}]}]|
|needDot|Boolean|是否需要显示进度点||false|
|dotStyle|Array|进度点样式配置,最多支持两种样式叠加,为保证进度点的清晰显示第一个点默认添加阴影。如果第一个进度点直径比进度条更大时,为了保证在画布内完整显示进度点,绘制的进度条圆圈必须减少对应的差值,其中shadow是可选的配置,shadow的值是`(0, 0, r/2, shadow)`||dotStyle: [{r: 24, fillStyle: '#fff', shadow: 'rgba(0,0,0,.15)'}, {r: 10, fillStyle: '#56B37F'}]|
Expand Down
Binary file added assets/images/percent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bbe270e

Please sign in to comment.