update Slider

This commit is contained in:
梁灏 2017-07-10 13:46:14 +08:00
parent 1dad8a571e
commit ce45917bde

View file

@ -48,6 +48,7 @@
import InputNumber from '../../components/input-number/input-number.vue';
import Tooltip from '../../components/tooltip/tooltip.vue';
import { getStyle, oneOf } from '../../utils/assist';
import { on, off } from '../../utils';
import Emitter from '../../mixins/emitter';
const prefixCls = 'ivu-slider';
@ -278,8 +279,10 @@
if (this.disabled) return;
event.preventDefault();
this.onSingleDragStart(event);
window.addEventListener('mousemove', this.onSingleDragging);
window.addEventListener('mouseup', this.onSingleDragEnd);
// window.addEventListener('mousemove', this.onSingleDragging);
// window.addEventListener('mouseup', this.onSingleDragEnd);
on(window, 'mousemove', this.onSingleDragging);
on(window, 'mouseup', this.onSingleDragEnd);
},
onSingleDragStart (event) {
this.dragging = true;
@ -300,8 +303,10 @@
this.dragging = false;
this.$refs.tooltip.visible = false;
this.changeSinglePosition(this.newPos);
window.removeEventListener('mousemove', this.onSingleDragging);
window.removeEventListener('mouseup', this.onSingleDragEnd);
// window.removeEventListener('mousemove', this.onSingleDragging);
// window.removeEventListener('mouseup', this.onSingleDragEnd);
off(window, 'mousemove', this.onSingleDragging);
off(window, 'mouseup', this.onSingleDragEnd);
}
},
changeSinglePosition (newPos) {
@ -337,8 +342,10 @@
if (this.disabled) return;
event.preventDefault();
this.onFirstDragStart(event);
window.addEventListener('mousemove', this.onFirstDragging);
window.addEventListener('mouseup', this.onFirstDragEnd);
// window.addEventListener('mousemove', this.onFirstDragging);
// window.addEventListener('mouseup', this.onFirstDragEnd);
on(window, 'mousemove', this.onFirstDragging);
on(window, 'mouseup', this.onFirstDragEnd);
},
onFirstDragStart (event) {
this.firstDragging = true;
@ -359,8 +366,10 @@
this.firstDragging = false;
this.$refs.tooltip.visible = false;
this.changeFirstPosition(this.newPos);
window.removeEventListener('mousemove', this.onFirstDragging);
window.removeEventListener('mouseup', this.onFirstDragEnd);
// window.removeEventListener('mousemove', this.onFirstDragging);
// window.removeEventListener('mouseup', this.onFirstDragEnd);
off(window, 'mousemove', this.onFirstDragging);
off(window, 'mouseup', this.onFirstDragEnd);
}
},
changeFirstPosition (newPos) {
@ -390,8 +399,10 @@
if (this.disabled) return;
event.preventDefault();
this.onSecondDragStart(event);
window.addEventListener('mousemove', this.onSecondDragging);
window.addEventListener('mouseup', this.onSecondDragEnd);
// window.addEventListener('mousemove', this.onSecondDragging);
// window.addEventListener('mouseup', this.onSecondDragEnd);
on(window, 'mousemove', this.onSecondDragging);
on(window, 'mouseup', this.onSecondDragEnd);
},
onSecondDragStart (event) {
this.secondDragging = true;
@ -412,8 +423,10 @@
this.secondDragging = false;
this.$refs.tooltip2.visible = false;
this.changeSecondPosition(this.newPos);
window.removeEventListener('mousemove', this.onSecondDragging);
window.removeEventListener('mouseup', this.onSecondDragEnd);
// window.removeEventListener('mousemove', this.onSecondDragging);
// window.removeEventListener('mouseup', this.onSecondDragEnd);
off(window, 'mousemove', this.onSecondDragging);
off(window, 'mouseup', this.onSecondDragEnd);
}
},
changeSecondPosition (newPos) {