fengyuanchen / vue-carousel

Carousel component for Vue.js.
https://fengyuanchen.github.io/vue-carousel/
MIT License
188 stars 34 forks source link

Javascript error: start is not a function #5

Closed maarten-kieft closed 5 years ago

maarten-kieft commented 5 years ago

If you clicked the next slide you will get an error like this:

e.start is not a function at c (main.js:formatted:8308) at a.slideEnd (main.js:formatted:8329) at t (main.js:formatted:865) at HTMLDivElement.Pr.t._withTask.o._withTask (main.js:formatted:2674)

When going trhough the source its this code actually:

slideEnd() { const moveX = this.endX - this.startX; const moveY = this.endY - this.startY; const thresholdX = this.$el.offsetWidth / 5; const thresholdY = this.$el.offsetHeight / 5; const top = moveY < -thresholdY; const right = moveX > thresholdX; const bottom = moveY > thresholdY; const left = moveX < -thresholdX; const done = () => { if (this.pauseOnEnter) { this.start(); } };

The start method is not defined anywhere. I'am also not sure what its supposed to do, because it seem to work fine.

tchenu commented 5 years ago

Hello,

Same issue here. :smiley:

maarten-kieft commented 5 years ago

The workaround is to add this line of code: VueCarousel.methods.start = function () { };

Add it before you initiate a carousel.

tchenu commented 5 years ago

@maarten-kieft Yes, thank's. I'm waiting a fix by @fengyuanchen 👍