Commit eb6d85bee756cacca29707f30c5b07ef021b3113

Authored by 梁灏
1 parent 656cc142

fix #4281

Showing 1 changed file with 7 additions and 0 deletions   Show diff stats
src/components/slider/slider.vue
@@ -344,6 +344,13 @@ @@ -344,6 +344,13 @@
344 const modulus = this.handleDecimal(newPos,this.step); 344 const modulus = this.handleDecimal(newPos,this.step);
345 const value = this.currentValue; 345 const value = this.currentValue;
346 value[index] = newPos - modulus; 346 value[index] = newPos - modulus;
  347 +
  348 + // 判断左右是否相等,否则会出现左边大于右边的情况
  349 + if (this.range) {
  350 + if (type === 'min' && value[0] > value[1]) value[1] = value[0];
  351 + if (type === 'max' && value[0] > value[1]) value[0] = value[1];
  352 + }
  353 +
347 this.currentValue = [...value]; 354 this.currentValue = [...value];
348 355
349 if (!this.dragging) { 356 if (!this.dragging) {