From ce4c0faafc7121d576d07ca9c02c252ce9686ab6 Mon Sep 17 00:00:00 2001 From: oustn Date: Fri, 14 Jul 2017 11:32:44 +0800 Subject: [PATCH] 修复 Slider 滑动按钮单击时数值跳动 issue --- src/components/slider/slider.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/slider/slider.vue b/src/components/slider/slider.vue index ab8773b..5574fa3 100644 --- a/src/components/slider/slider.vue +++ b/src/components/slider/slider.vue @@ -285,11 +285,12 @@ on(window, 'mouseup', this.onSingleDragEnd); }, onSingleDragStart (event) { - this.dragging = true; + this.dragging = false; this.startX = event.clientX; this.startPos = parseInt(this.singlePosition, 10); }, onSingleDragging (event) { + this.dragging = true; if (this.dragging) { this.$refs.tooltip.visible = true; this.currentX = event.clientX; @@ -305,9 +306,9 @@ this.changeSinglePosition(this.newPos); // window.removeEventListener('mousemove', this.onSingleDragging); // window.removeEventListener('mouseup', this.onSingleDragEnd); - off(window, 'mousemove', this.onSingleDragging); - off(window, 'mouseup', this.onSingleDragEnd); } + off(window, 'mousemove', this.onSingleDragging); + off(window, 'mouseup', this.onSingleDragEnd); }, changeSinglePosition (newPos) { if (newPos < 0) { @@ -348,11 +349,12 @@ on(window, 'mouseup', this.onFirstDragEnd); }, onFirstDragStart (event) { - this.firstDragging = true; + this.firstDragging = false; this.startX = event.clientX; this.startPos = parseInt(this.firstPosition, 10); }, onFirstDragging (event) { + this.firstDragging = true; if (this.firstDragging) { this.$refs.tooltip.visible = true; this.currentX = event.clientX; @@ -368,9 +370,9 @@ this.changeFirstPosition(this.newPos); // window.removeEventListener('mousemove', this.onFirstDragging); // window.removeEventListener('mouseup', this.onFirstDragEnd); - off(window, 'mousemove', this.onFirstDragging); - off(window, 'mouseup', this.onFirstDragEnd); } + off(window, 'mousemove', this.onFirstDragging); + off(window, 'mouseup', this.onFirstDragEnd); }, changeFirstPosition (newPos) { if (newPos < 0) { @@ -405,11 +407,12 @@ on(window, 'mouseup', this.onSecondDragEnd); }, onSecondDragStart (event) { - this.secondDragging = true; + this.secondDragging = false; this.startX = event.clientX; this.startPos = parseInt(this.secondPosition, 10); }, onSecondDragging (event) { + this.secondDragging = true; if (this.secondDragging) { this.$refs.tooltip2.visible = true; this.currentX = event.clientX; @@ -425,9 +428,9 @@ this.changeSecondPosition(this.newPos); // window.removeEventListener('mousemove', this.onSecondDragging); // window.removeEventListener('mouseup', this.onSecondDragEnd); - off(window, 'mousemove', this.onSecondDragging); - off(window, 'mouseup', this.onSecondDragEnd); } + off(window, 'mousemove', this.onSecondDragging); + off(window, 'mouseup', this.onSecondDragEnd); }, changeSecondPosition (newPos) { if (newPos > 100) { -- libgit2 0.21.4