From f579ac54b7eb6b16d0a8f97bcf3f6b943caa4123 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:13:00 +0300 Subject: [PATCH] Revert #967 --- src/components/slider/Slider.vue | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/components/slider/Slider.vue b/src/components/slider/Slider.vue index 2e7a2cdc6..eb5438c75 100755 --- a/src/components/slider/Slider.vue +++ b/src/components/slider/Slider.vue @@ -85,25 +85,6 @@ export default { } this.updateModel(event, newValue); }, - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor - decimalAdjust(type, value, exp) { - // If the exp is undefined or zero... - if (typeof exp === 'undefined' || +exp === 0) { - return Math[type](value); - } - value = +value; - exp = +exp; - // If the value is not a number or the exp is not an integer... - if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) { - return NaN; - } - // Shift - value = value.toString().split('e'); - value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp))); - // Shift back - value = value.toString().split('e'); - return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)); - }, updateModel(event, value) { let newValue = value; let modelValue; @@ -119,7 +100,7 @@ export default { else if (newValue >= maxValue) newValue = maxValue; - modelValue[0] = this.decimalAdjust('floor', newValue, -2); + modelValue[0] = Math.floor(newValue); modelValue[1] = modelValue[1] || this.max; } else { @@ -130,7 +111,7 @@ export default { newValue = minValue; modelValue[0] = modelValue[0] || this.min; - modelValue[1] = this.decimalAdjust('floor', newValue, -2); + modelValue[1] = Math.floor(newValue); } } else { @@ -139,7 +120,7 @@ export default { else if (newValue > this.max) newValue = this.max; - modelValue = this.decimalAdjust('floor', newValue, -2); + modelValue = newValue; } this.$emit('update:modelValue', modelValue);