From 062afd48e24ef4daedb268174f09301281000ecb Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 4 Dec 2019 10:31:54 +0800 Subject: [PATCH] =?UTF-8?q?BI-56574=20fix:=20setValue=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=EF=BC=8Cpopulate=E9=9C=80=E8=A6=81=E5=88=B7=E6=96=B0label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/intervalslider/intervalslider.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/widget/intervalslider/intervalslider.js b/src/widget/intervalslider/intervalslider.js index fb97a2a256..1c38182524 100644 --- a/src/widget/intervalslider/intervalslider.js +++ b/src/widget/intervalslider/intervalslider.js @@ -334,11 +334,15 @@ BI.IntervalSlider = BI.inherit(BI.Single, { valueTwo = BI.parseFloat(valueTwo); if((oldValueOne <= oldValueTwo && valueOne > valueTwo) || (oldValueOne >= oldValueTwo && valueOne < valueTwo)) { var isSliderOneLeft = BI.parseFloat(this.sliderOne.element[0].style.left) < BI.parseFloat(this.sliderTwo.element[0].style.left); - this.labelOne.element.css({left: isSliderOneLeft ? "0%" : "100%"}); - this.labelTwo.element.css({left: isSliderOneLeft ? "100%" : "0%"}); + this._resetLabelPosition(!isSliderOneLeft); } }, + _resetLabelPosition: function(needReverse) { + this.labelOne.element.css({left: needReverse ? "100%" : "0%"}); + this.labelTwo.element.css({left: needReverse ? "0%" : "100%"}); + }, + _setSliderOnePosition: function (percent) { this.sliderOne.element.css({left: percent + "%"}); }, @@ -481,8 +485,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, { var o = this.options; var valueOne = BI.parseFloat(v.min); var valueTwo = BI.parseFloat(v.max); - valueOne = o.digit === false ? valueOne : valueOne.toFixed(o.digit); - valueTwo = o.digit === false ? valueTwo : valueTwo.toFixed(o.digit); + valueOne = o.digit === false ? valueOne : BI.parseFloat(valueOne.toFixed(o.digit)); + valueTwo = o.digit === false ? valueTwo : BI.parseFloat(valueTwo.toFixed(o.digit)); if (!isNaN(valueOne) && !isNaN(valueTwo)) { if (this._checkValidation(valueOne)) { this.valueOne = (this.valueOne <= this.valueTwo ? valueOne : valueTwo); @@ -523,6 +527,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, { this.labelTwo.setValue(this.max); this._setAllPosition(0, 100); } + this._resetLabelPosition(); } } });