Open cleverplatypus opened 5 years ago
There are use cases where it would be beneficial for the user to be able to conditionally cancel sliding.
beforeSlide(cancelFn) { if(someCondition) { cancelFn(); //sliding won't happen } }
Not sure how it would look like in code but there you go. :)
Maybe:
//Carousel.js:192 methods: { // controlling methods slideTo(slideIndex, isSource = true) { if (this.isSliding || slideIndex === this.currentSlide) { return; } let wasCanceled; const cancelFn = () => { wasCanceled = true; }; this.$emit('beforeSlide', { currentSlide: this.currentSlide, slideTo: index }, cancelFn); if(wasCanceled) { return; } //...
There are use cases where it would be beneficial for the user to be able to conditionally cancel sliding.
Not sure how it would look like in code but there you go. :)
Maybe: