Commit b964efae4e0f1ac5616057566986015b43470c91
1 parent
e807a971
Emit change on pointer up also
Showing
1 changed file
with
8 additions
and
3 deletions
Show diff stats
src/components/slider/slider.vue
| ... | ... | @@ -240,6 +240,7 @@ |
| 240 | 240 | if (this.dragging) { |
| 241 | 241 | this.dragging = false; |
| 242 | 242 | this.$refs[`${this.pointerDown}Tooltip`].visible = false; |
| 243 | + this.emitChange(); | |
| 243 | 244 | } |
| 244 | 245 | |
| 245 | 246 | this.pointerDown = ''; |
| ... | ... | @@ -261,14 +262,18 @@ |
| 261 | 262 | |
| 262 | 263 | if (!this.dragging) { |
| 263 | 264 | if (this.currentValue[index] !== this.oldValue[index]) { |
| 264 | - const exportValue = this.range ? this.currentValue : this.currentValue[0]; | |
| 265 | - this.$emit('on-change', exportValue); | |
| 266 | - this.dispatch('FormItem', 'on-form-change', exportValue); | |
| 265 | + this.emitChange(); | |
| 267 | 266 | this.oldValue[index] = this.currentValue[index]; |
| 268 | 267 | } |
| 269 | 268 | } |
| 270 | 269 | }, |
| 271 | 270 | |
| 271 | + emitChange(){ | |
| 272 | + const exportValue = this.range ? this.currentValue : this.currentValue[0]; | |
| 273 | + this.$emit('on-change', exportValue); | |
| 274 | + this.dispatch('FormItem', 'on-form-change', exportValue); | |
| 275 | + }, | |
| 276 | + | |
| 272 | 277 | sliderClick (event) { |
| 273 | 278 | if (this.disabled) return; |
| 274 | 279 | const currentX = this.getPointerX(event); | ... | ... |