From fd151031718f51fadd878969ab7563b7f6afe671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 14 May 2021 11:16:09 +0300 Subject: [PATCH] Fixed #967 - Decimal value for Slider step does not work --- src/components/slider/Slider.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/slider/Slider.vue b/src/components/slider/Slider.vue index eb5438c75..624faf14b 100755 --- a/src/components/slider/Slider.vue +++ b/src/components/slider/Slider.vue @@ -83,10 +83,13 @@ export default { else if (diff > 0) newValue = oldValue + Math.floor(newValue / this.step - oldValue / this.step) * this.step; } + else { + newValue = Math.floor(newValue); + } this.updateModel(event, newValue); }, updateModel(event, value) { - let newValue = value; + let newValue = parseFloat(value.toFixed(10)); let modelValue; if (this.range) { @@ -100,7 +103,7 @@ export default { else if (newValue >= maxValue) newValue = maxValue; - modelValue[0] = Math.floor(newValue); + modelValue[0] = newValue; modelValue[1] = modelValue[1] || this.max; } else { @@ -111,7 +114,7 @@ export default { newValue = minValue; modelValue[0] = modelValue[0] || this.min; - modelValue[1] = Math.floor(newValue); + modelValue[1] = newValue; } } else {