Commit 57f920ff65e07b3b8aaf19be999baf3e9f7a0e98

Authored by Aresn
Committed by GitHub
2 parents d293cc5c b4e43426

Merge pull request #1355 from oustn/2.0

修复 Slider 滑动按钮单击时数值跳动 issue
Showing 1 changed file with 12 additions and 9 deletions   Show diff stats
src/components/slider/slider.vue
@@ -285,11 +285,12 @@ @@ -285,11 +285,12 @@
285 on(window, 'mouseup', this.onSingleDragEnd); 285 on(window, 'mouseup', this.onSingleDragEnd);
286 }, 286 },
287 onSingleDragStart (event) { 287 onSingleDragStart (event) {
288 - this.dragging = true; 288 + this.dragging = false;
289 this.startX = event.clientX; 289 this.startX = event.clientX;
290 this.startPos = parseInt(this.singlePosition, 10); 290 this.startPos = parseInt(this.singlePosition, 10);
291 }, 291 },
292 onSingleDragging (event) { 292 onSingleDragging (event) {
  293 + this.dragging = true;
293 if (this.dragging) { 294 if (this.dragging) {
294 this.$refs.tooltip.visible = true; 295 this.$refs.tooltip.visible = true;
295 this.currentX = event.clientX; 296 this.currentX = event.clientX;
@@ -305,9 +306,9 @@ @@ -305,9 +306,9 @@
305 this.changeSinglePosition(this.newPos); 306 this.changeSinglePosition(this.newPos);
306 // window.removeEventListener('mousemove', this.onSingleDragging); 307 // window.removeEventListener('mousemove', this.onSingleDragging);
307 // window.removeEventListener('mouseup', this.onSingleDragEnd); 308 // window.removeEventListener('mouseup', this.onSingleDragEnd);
308 - off(window, 'mousemove', this.onSingleDragging);  
309 - off(window, 'mouseup', this.onSingleDragEnd);  
310 } 309 }
  310 + off(window, 'mousemove', this.onSingleDragging);
  311 + off(window, 'mouseup', this.onSingleDragEnd);
311 }, 312 },
312 changeSinglePosition (newPos) { 313 changeSinglePosition (newPos) {
313 if (newPos < 0) { 314 if (newPos < 0) {
@@ -348,11 +349,12 @@ @@ -348,11 +349,12 @@
348 on(window, 'mouseup', this.onFirstDragEnd); 349 on(window, 'mouseup', this.onFirstDragEnd);
349 }, 350 },
350 onFirstDragStart (event) { 351 onFirstDragStart (event) {
351 - this.firstDragging = true; 352 + this.firstDragging = false;
352 this.startX = event.clientX; 353 this.startX = event.clientX;
353 this.startPos = parseInt(this.firstPosition, 10); 354 this.startPos = parseInt(this.firstPosition, 10);
354 }, 355 },
355 onFirstDragging (event) { 356 onFirstDragging (event) {
  357 + this.firstDragging = true;
356 if (this.firstDragging) { 358 if (this.firstDragging) {
357 this.$refs.tooltip.visible = true; 359 this.$refs.tooltip.visible = true;
358 this.currentX = event.clientX; 360 this.currentX = event.clientX;
@@ -368,9 +370,9 @@ @@ -368,9 +370,9 @@
368 this.changeFirstPosition(this.newPos); 370 this.changeFirstPosition(this.newPos);
369 // window.removeEventListener('mousemove', this.onFirstDragging); 371 // window.removeEventListener('mousemove', this.onFirstDragging);
370 // window.removeEventListener('mouseup', this.onFirstDragEnd); 372 // window.removeEventListener('mouseup', this.onFirstDragEnd);
371 - off(window, 'mousemove', this.onFirstDragging);  
372 - off(window, 'mouseup', this.onFirstDragEnd);  
373 } 373 }
  374 + off(window, 'mousemove', this.onFirstDragging);
  375 + off(window, 'mouseup', this.onFirstDragEnd);
374 }, 376 },
375 changeFirstPosition (newPos) { 377 changeFirstPosition (newPos) {
376 if (newPos < 0) { 378 if (newPos < 0) {
@@ -405,11 +407,12 @@ @@ -405,11 +407,12 @@
405 on(window, 'mouseup', this.onSecondDragEnd); 407 on(window, 'mouseup', this.onSecondDragEnd);
406 }, 408 },
407 onSecondDragStart (event) { 409 onSecondDragStart (event) {
408 - this.secondDragging = true; 410 + this.secondDragging = false;
409 this.startX = event.clientX; 411 this.startX = event.clientX;
410 this.startPos = parseInt(this.secondPosition, 10); 412 this.startPos = parseInt(this.secondPosition, 10);
411 }, 413 },
412 onSecondDragging (event) { 414 onSecondDragging (event) {
  415 + this.secondDragging = true;
413 if (this.secondDragging) { 416 if (this.secondDragging) {
414 this.$refs.tooltip2.visible = true; 417 this.$refs.tooltip2.visible = true;
415 this.currentX = event.clientX; 418 this.currentX = event.clientX;
@@ -425,9 +428,9 @@ @@ -425,9 +428,9 @@
425 this.changeSecondPosition(this.newPos); 428 this.changeSecondPosition(this.newPos);
426 // window.removeEventListener('mousemove', this.onSecondDragging); 429 // window.removeEventListener('mousemove', this.onSecondDragging);
427 // window.removeEventListener('mouseup', this.onSecondDragEnd); 430 // window.removeEventListener('mouseup', this.onSecondDragEnd);
428 - off(window, 'mousemove', this.onSecondDragging);  
429 - off(window, 'mouseup', this.onSecondDragEnd);  
430 } 431 }
  432 + off(window, 'mousemove', this.onSecondDragging);
  433 + off(window, 'mouseup', this.onSecondDragEnd);
431 }, 434 },
432 changeSecondPosition (newPos) { 435 changeSecondPosition (newPos) {
433 if (newPos > 100) { 436 if (newPos > 100) {