Commit cd07742407fb30c443a23c4158ddad4e8d4505d9
1 parent
3b71312a
slider组件 step为小数时回不到100的bug
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
src/components/slider/slider.vue
| ... | ... | @@ -327,7 +327,7 @@ |
| 327 | 327 | if (type === 'min') newPos = this.checkLimits([newPos, this.maxPosition])[0]; |
| 328 | 328 | else newPos = this.checkLimits([this.minPosition, newPos])[1]; |
| 329 | 329 | |
| 330 | - const modulus = this.handleDecimal(newPos,this.step) | |
| 330 | + const modulus = this.handleDecimal(newPos,this.step); | |
| 331 | 331 | const value = this.currentValue; |
| 332 | 332 | value[index] = newPos - modulus; |
| 333 | 333 | this.currentValue = [...value]; |
| ... | ... | @@ -342,10 +342,12 @@ |
| 342 | 342 | if(step<1){ |
| 343 | 343 | let sl = step.toString(), |
| 344 | 344 | multiple = 1, |
| 345 | - m = 0; | |
| 345 | + m; | |
| 346 | 346 | try { |
| 347 | - m += sl.split('.')[1].length; | |
| 348 | - } catch (e) {} | |
| 347 | + m = sl.split('.')[1].length; | |
| 348 | + } catch (e){ | |
| 349 | + m = 0; | |
| 350 | + } | |
| 349 | 351 | multiple = Math.pow(10,m); |
| 350 | 352 | return (pos * multiple) % (step * multiple) / multiple; |
| 351 | 353 | }else return pos % step; | ... | ... |