From 540b1e1812c17ced03607d423ab67802d4ff1d23 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: Mon, 13 Dec 2021 20:39:11 +0300 Subject: [PATCH] Fixed #1882 - Slider range with min/max bug --- src/components/slider/Slider.vue | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/components/slider/Slider.vue b/src/components/slider/Slider.vue index fb452c2c7d..b0c324f8be 100755 --- a/src/components/slider/Slider.vue +++ b/src/components/slider/Slider.vue @@ -2,7 +2,7 @@
+ role="slider" :aria-valuemin="min" :aria-valuenow="value" :aria-valuemax="max" :aria-labelledby="ariaLabelledBy"> = this.value[1]) - newValue = this.value[1]; + else if (newValue >= maxValue) + newValue = maxValue; + + modelValue[0] = newValue; + modelValue[1] = modelValue[1] || this.max; } else { + let minValue = this.value ? this.value[0] : this.min; if (newValue > this.max) newValue = this.max; - else if (newValue <= this.value[0]) - newValue = this.value[0]; - } + else if (newValue <= minValue) + newValue = minValue; - modelValue = [...this.value]; - modelValue[this.handleIndex] = newValue; + modelValue[0] = modelValue[0] || this.min; + modelValue[1] = newValue; + } } + else { if (newValue < this.min) newValue = this.min; @@ -301,7 +310,6 @@ export default { return {'left': this.handlePosition + '%'}; else return {'bottom': this.handlePosition + '%'}; - }, handlePosition() { if (this.value < this.min) @@ -312,16 +320,16 @@ export default { return (this.value - this.min) * 100 / (this.max - this.min); }, rangeStartPosition() { - if (this.value) + if (this.value && this.value[0]) return (this.value[0] < this.min ? 0 : this.value[0] - this.min) * 100 / (this.max - this.min); else return 0; }, rangeEndPosition() { - if (this.value) + if (this.value && this.value[1]) return (this.value[1] > this.max ? 100 : this.value[1] - this.min) * 100 / (this.max - this.min); else - return 0; + return 100; }, rangeStartHandleStyle() { if (this.horizontal)