Skip to content

Commit 6e030cf

Browse files
Dobromir Hristovrstoenescu
authored andcommitted
feat: Add direction as a second parameter to the Slider's slide event. (quasarframework#530)
1 parent 37e27b6 commit 6e030cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/slider/QSlider.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,11 @@ export default {
153153
}
154154
},
155155
goToSlide (slide, done) {
156+
let direction = ''
156157
this.__cleanup()
157158
158159
const finish = () => {
159-
this.$emit('slide', this.slide)
160+
this.$emit('slide', this.slide, direction)
160161
this.__planAutoPlay()
161162
if (typeof done === 'function') {
162163
done()
@@ -171,7 +172,7 @@ export default {
171172
if (!this.hasOwnProperty('initialPosition')) {
172173
this.position = -this.slide * 100
173174
}
174-
175+
direction = slide > this.slide ? 'next' : 'previous'
175176
if (this.infinite) {
176177
this.slide = normalizeToInterval(slide, 0, this.slidesNumber - 1)
177178
this.positionSlide = normalizeToInterval(slide, -1, this.slidesNumber)

0 commit comments

Comments
 (0)