From eb6d85bee756cacca29707f30c5b07ef021b3113 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Wed, 9 Jan 2019 10:30:37 +0800 Subject: [PATCH] fix #4281 --- src/components/slider/slider.vue | 7 +++++++ 1 file changed, 7 insertions(+), 0 deletions(-) diff --git a/src/components/slider/slider.vue b/src/components/slider/slider.vue index 326144c..af15eb4 100644 --- a/src/components/slider/slider.vue +++ b/src/components/slider/slider.vue @@ -344,6 +344,13 @@ const modulus = this.handleDecimal(newPos,this.step); const value = this.currentValue; value[index] = newPos - modulus; + + // 判断左右是否相等,否则会出现左边大于右边的情况 + if (this.range) { + if (type === 'min' && value[0] > value[1]) value[1] = value[0]; + if (type === 'max' && value[0] > value[1]) value[0] = value[1]; + } + this.currentValue = [...value]; if (!this.dragging) { -- libgit2 0.21.4