update Slider
This commit is contained in:
parent
1dad8a571e
commit
ce45917bde
1 changed files with 25 additions and 12 deletions
|
@ -48,6 +48,7 @@
|
||||||
import InputNumber from '../../components/input-number/input-number.vue';
|
import InputNumber from '../../components/input-number/input-number.vue';
|
||||||
import Tooltip from '../../components/tooltip/tooltip.vue';
|
import Tooltip from '../../components/tooltip/tooltip.vue';
|
||||||
import { getStyle, oneOf } from '../../utils/assist';
|
import { getStyle, oneOf } from '../../utils/assist';
|
||||||
|
import { on, off } from '../../utils';
|
||||||
import Emitter from '../../mixins/emitter';
|
import Emitter from '../../mixins/emitter';
|
||||||
|
|
||||||
const prefixCls = 'ivu-slider';
|
const prefixCls = 'ivu-slider';
|
||||||
|
@ -278,8 +279,10 @@
|
||||||
if (this.disabled) return;
|
if (this.disabled) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.onSingleDragStart(event);
|
this.onSingleDragStart(event);
|
||||||
window.addEventListener('mousemove', this.onSingleDragging);
|
// window.addEventListener('mousemove', this.onSingleDragging);
|
||||||
window.addEventListener('mouseup', this.onSingleDragEnd);
|
// window.addEventListener('mouseup', this.onSingleDragEnd);
|
||||||
|
on(window, 'mousemove', this.onSingleDragging);
|
||||||
|
on(window, 'mouseup', this.onSingleDragEnd);
|
||||||
},
|
},
|
||||||
onSingleDragStart (event) {
|
onSingleDragStart (event) {
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
|
@ -300,8 +303,10 @@
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
this.$refs.tooltip.visible = false;
|
this.$refs.tooltip.visible = false;
|
||||||
this.changeSinglePosition(this.newPos);
|
this.changeSinglePosition(this.newPos);
|
||||||
window.removeEventListener('mousemove', this.onSingleDragging);
|
// window.removeEventListener('mousemove', this.onSingleDragging);
|
||||||
window.removeEventListener('mouseup', this.onSingleDragEnd);
|
// window.removeEventListener('mouseup', this.onSingleDragEnd);
|
||||||
|
off(window, 'mousemove', this.onSingleDragging);
|
||||||
|
off(window, 'mouseup', this.onSingleDragEnd);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeSinglePosition (newPos) {
|
changeSinglePosition (newPos) {
|
||||||
|
@ -337,8 +342,10 @@
|
||||||
if (this.disabled) return;
|
if (this.disabled) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.onFirstDragStart(event);
|
this.onFirstDragStart(event);
|
||||||
window.addEventListener('mousemove', this.onFirstDragging);
|
// window.addEventListener('mousemove', this.onFirstDragging);
|
||||||
window.addEventListener('mouseup', this.onFirstDragEnd);
|
// window.addEventListener('mouseup', this.onFirstDragEnd);
|
||||||
|
on(window, 'mousemove', this.onFirstDragging);
|
||||||
|
on(window, 'mouseup', this.onFirstDragEnd);
|
||||||
},
|
},
|
||||||
onFirstDragStart (event) {
|
onFirstDragStart (event) {
|
||||||
this.firstDragging = true;
|
this.firstDragging = true;
|
||||||
|
@ -359,8 +366,10 @@
|
||||||
this.firstDragging = false;
|
this.firstDragging = false;
|
||||||
this.$refs.tooltip.visible = false;
|
this.$refs.tooltip.visible = false;
|
||||||
this.changeFirstPosition(this.newPos);
|
this.changeFirstPosition(this.newPos);
|
||||||
window.removeEventListener('mousemove', this.onFirstDragging);
|
// window.removeEventListener('mousemove', this.onFirstDragging);
|
||||||
window.removeEventListener('mouseup', this.onFirstDragEnd);
|
// window.removeEventListener('mouseup', this.onFirstDragEnd);
|
||||||
|
off(window, 'mousemove', this.onFirstDragging);
|
||||||
|
off(window, 'mouseup', this.onFirstDragEnd);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeFirstPosition (newPos) {
|
changeFirstPosition (newPos) {
|
||||||
|
@ -390,8 +399,10 @@
|
||||||
if (this.disabled) return;
|
if (this.disabled) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.onSecondDragStart(event);
|
this.onSecondDragStart(event);
|
||||||
window.addEventListener('mousemove', this.onSecondDragging);
|
// window.addEventListener('mousemove', this.onSecondDragging);
|
||||||
window.addEventListener('mouseup', this.onSecondDragEnd);
|
// window.addEventListener('mouseup', this.onSecondDragEnd);
|
||||||
|
on(window, 'mousemove', this.onSecondDragging);
|
||||||
|
on(window, 'mouseup', this.onSecondDragEnd);
|
||||||
},
|
},
|
||||||
onSecondDragStart (event) {
|
onSecondDragStart (event) {
|
||||||
this.secondDragging = true;
|
this.secondDragging = true;
|
||||||
|
@ -412,8 +423,10 @@
|
||||||
this.secondDragging = false;
|
this.secondDragging = false;
|
||||||
this.$refs.tooltip2.visible = false;
|
this.$refs.tooltip2.visible = false;
|
||||||
this.changeSecondPosition(this.newPos);
|
this.changeSecondPosition(this.newPos);
|
||||||
window.removeEventListener('mousemove', this.onSecondDragging);
|
// window.removeEventListener('mousemove', this.onSecondDragging);
|
||||||
window.removeEventListener('mouseup', this.onSecondDragEnd);
|
// window.removeEventListener('mouseup', this.onSecondDragEnd);
|
||||||
|
off(window, 'mousemove', this.onSecondDragging);
|
||||||
|
off(window, 'mouseup', this.onSecondDragEnd);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeSecondPosition (newPos) {
|
changeSecondPosition (newPos) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue