Slider: add mousedown event

pull/21277/head
rikapo 2021-08-30 15:37:22 +09:00
parent f71afe023c
commit ffb78ee754
5 changed files with 9 additions and 1 deletions

View File

@ -236,6 +236,6 @@ Selecting a range of values is supported.
## Events
| Event Name | Description | Parameters |
|---------- |-------- |---------- |
| mousedown | triggers when the user clicks the slider (if the mouse is being dragged, this event only fires when the mouse button is pressed) | value before changing |
| change | triggers when the value changes (if the mouse is being dragged, this event only fires when the mouse is released) | value after changing |
| input | triggers when the data changes (It'll be emitted in real time during sliding) | value after changing |

View File

@ -238,6 +238,7 @@ Se soporta la selección de un rango de valores.
## Eventos
| Nombre | Descripción | Parámetros |
| ------ | ---------------------------------------- | ------------------------ |
| mousedown | triggers when the user clicks the slider (if the mouse is being dragged, this event only fires when the mouse button is pressed) | value before changing |
| change | se dispara cuando el valor cambia (si el ratón está comenzando el arrastre este evento sólo se disparara cuando se suelte el ratón) | valor después del cambio |
| input | Se dispara cuando los datos cambian (funciona en tiempo real) | valor después del cambio |

View File

@ -236,5 +236,6 @@ Vous pouvez sélectionner des intervalles de valeurs au lieu d'une valeur unique
| Nom | Description | Paramètres |
|---------- |-------- |---------- |
| mousedown | triggers when the user clicks the slider (if the mouse is being dragged, this event only fires when the mouse button is pressed) | value before changing |
| change | Se déclenche quand la valeur change (si le changement est fait à la souris, se déclenche quand la souris redevient immobile). | La nouvelle valeur. |
| input | triggers when the data changes (It'll be emitted in real time during sliding) | value after changing |

View File

@ -233,5 +233,6 @@
### Events
| 事件名称 | 说明 | 回调参数 |
|---------- |-------- |---------- |
| mousedown | 点击或开始拖动滑块时触发 | 改变前的值 |
| change | 值改变时触发(使用鼠标拖曳时,只在松开鼠标后触发) | 改变后的值 |
| input | 数据改变时触发(使用鼠标拖曳时,活动过程实时触发) | 改变后的值 |

View File

@ -27,6 +27,7 @@
:class="{ 'show-input': showInput, 'disabled': sliderDisabled }"
:style="runwayStyle"
@click="onSliderClick"
@mousedown="emitMouseDown"
ref="slider">
<div
class="el-slider__bar"
@ -297,6 +298,10 @@
});
},
emitMouseDown() {
this.$emit('mousedown', this.value);
},
getStopStyle(position) {
return this.vertical ? { 'bottom': position + '%' } : { 'left': position + '%' };
}