diff --git a/src/circle/README.md b/src/circle/README.md
index 8d00c40d0..429788206 100644
--- a/src/circle/README.md
+++ b/src/circle/README.md
@@ -64,7 +64,7 @@ export default {
| color | Progress bar color | `String` | `#1989fa` |
| layer-color | Layer color | `String` | `#fff` |
| fill | Fill color | `String` | `none` |
-| speed | Animate speed(rate/s)| `Number` | - |
+| speed | Animate speed(rate/s)| `Number` | `0` |
| text | Text | `String` | - |
| stroke-width | Stroke width | `Number` | `40` |
| clockwise | Is clockwise | `Boolean` | `true` |
diff --git a/src/circle/README.zh-CN.md b/src/circle/README.zh-CN.md
index 4894d52af..ec21922ec 100644
--- a/src/circle/README.zh-CN.md
+++ b/src/circle/README.zh-CN.md
@@ -10,7 +10,8 @@ Vue.use(Circle);
## 代码演示
### 基础用法
-通过 `rate` 指定目标进度,`v-model` 代表当前进度,`speed` 控制动画速度
+
+`rate`属性表示进度条的目标进度,`v-model`表示动画过程中的实时进度。当`rate`发生变化时,`v-model`会以`speed`的速度变化,直至达到`rate`设定的值。
```html
-
+
+
+
+
@@ -44,10 +47,10 @@ const format = rate => Math.min(Math.max(rate, 0), 100);
export default {
i18n: {
'zh-CN': {
- title2: '样式定制'
+ customStyle: '样式定制'
},
'en-US': {
- title2: 'Custom Style'
+ customStyle: 'Custom Style'
}
},
diff --git a/src/circle/index.js b/src/circle/index.js
index be62bf167..4a97bd2f8 100644
--- a/src/circle/index.js
+++ b/src/circle/index.js
@@ -56,6 +56,7 @@ export default createComponent({
layerStyle() {
let offset = (PERIMETER * (100 - this.value)) / 100;
offset = this.clockwise ? offset : PERIMETER * 2 - offset;
+
return {
stroke: `${this.color}`,
strokeDashoffset: `${offset}px`,
@@ -80,6 +81,7 @@ export default createComponent({
this.endRate = format(this.rate);
this.increase = this.endRate > this.startRate;
this.duration = Math.abs(((this.startRate - this.endRate) * 1000) / this.speed);
+
if (this.speed) {
cancelRaf(this.rafId);
this.rafId = raf(this.animate);
@@ -97,6 +99,7 @@ export default createComponent({
const progress = Math.min((now - this.startTime) / this.duration, 1);
const rate = progress * (this.endRate - this.startRate) + this.startRate;
this.$emit('input', format(parseFloat(rate.toFixed(1))));
+
if (this.increase ? rate < this.endRate : rate > this.endRate) {
this.rafId = raf(this.animate);
}
diff --git a/src/circle/test/__snapshots__/demo.spec.js.snap b/src/circle/test/__snapshots__/demo.spec.js.snap
index 28fba2f17..aee6974a5 100644
--- a/src/circle/test/__snapshots__/demo.spec.js.snap
+++ b/src/circle/test/__snapshots__/demo.spec.js.snap
@@ -9,13 +9,15 @@ exports[`renders demo correctly 1`] = `
30%
+
+
+
`;