mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
fix(circle): Fix the bug of shake when the circle component value is a decimal number. (#4152)
* fix(circle): Fix the bug of shake when the circle component value is a decimal number * fix(circle): Fix the bug of shake when the circle component value is a decimal number
This commit is contained in:
parent
9d1c8b2ca9
commit
a641b0922d
@ -185,11 +185,15 @@ VantComponent({
|
|||||||
this.currentValue = this.currentValue || 0;
|
this.currentValue = this.currentValue || 0;
|
||||||
this.interval = setInterval(() => {
|
this.interval = setInterval(() => {
|
||||||
if (this.currentValue !== value) {
|
if (this.currentValue !== value) {
|
||||||
|
if (Math.abs(this.currentValue - value) < STEP) {
|
||||||
|
this.currentValue = value;
|
||||||
|
} else {
|
||||||
if (this.currentValue < value) {
|
if (this.currentValue < value) {
|
||||||
this.currentValue += STEP;
|
this.currentValue += STEP;
|
||||||
} else {
|
} else {
|
||||||
this.currentValue -= STEP;
|
this.currentValue -= STEP;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.drawCircle(this.currentValue);
|
this.drawCircle(this.currentValue);
|
||||||
} else {
|
} else {
|
||||||
this.clearInterval();
|
this.clearInterval();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user