Skip to content

Commit

Permalink
fix(Circle): README.md size type mistaken (#2694)
Browse files Browse the repository at this point in the history
* fix(Circle): size support unit

* fix(Circle):  README.md size type mistaken
  • Loading branch information
Lindysen authored Feb 5, 2020
1 parent 3f550d4 commit b85187a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/circle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Page({
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| ------------ | -------------------------------------- | ------------------ | --------- | ---- |
| value | 目标进度 | *number* | `0` | - |
| size | 圆环直径,默认单位为 `px` | *string \| number* | `100` | - |
| size | 圆环直径,默认单位为 `px` | *number* | `100` | - |
| color | 进度条颜色,传入对象格式可以定义渐变色 | *string \| object* | `#1989fa` | - |
| layer-color | 轨道颜色 | *string* | `#fff` | - |
| fill | 填充颜色 | *string* | - | - |
Expand Down
10 changes: 0 additions & 10 deletions packages/circle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ VantComponent({
size: {
type: Number,
value: 100,
observer: 'setStyle'
},
fill: String,
layerColor: {
Expand All @@ -51,7 +50,6 @@ VantComponent({
},

data: {
style: 'width: 100px; height: 100px;',
hoverColor: BLUE
},

Expand All @@ -78,14 +76,6 @@ VantComponent({

this.setData({ hoverColor });
},

setStyle() {
const { size } = this.data;
const style = `width: ${size}px; height: ${size}px;`;

this.setData({ style });
},

presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) {
const { strokeWidth, lineCap, clockwise, size } = this.data;
const position = size / 2;
Expand Down
4 changes: 3 additions & 1 deletion packages/circle/index.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />

<view class="van-circle">
<canvas class="van-circle__canvas" style="{{ style }}" canvas-id="van-circle"></canvas>
<canvas class="van-circle__canvas" style="width: {{ utils.addUnit(size) }};height:{{ utils.addUnit(size) }}" canvas-id="van-circle"></canvas>
<view wx:if="{{ !text }}" class="van-circle__text">
<slot></slot>
</view>
Expand Down

0 comments on commit b85187a

Please sign in to comment.