diff --git a/src/components/Carousel/Carousel.vue b/src/components/Carousel/Carousel.vue index 48729b8..c523650 100644 --- a/src/components/Carousel/Carousel.vue +++ b/src/components/Carousel/Carousel.vue @@ -225,9 +225,9 @@ export default { this.maxPages = this.slidesWidth.findIndex(({ offsetLeft }) => offsetLeft > maxPos) - 1 }, calcNextWidth(direction) { - const nextSlideIndex = direction > 0 ? this.currentPage : this.currentPage + direction + const nextSlideIndex = Math.max( direction > 0 ? this.currentPage : this.currentPage + direction, 0) // Don't use ES6 destructing - reduce bundle size - const width = this.slidesWidth[nextSlideIndex].width || 0 + const width = nextSlideIndex >=0 && this.slidesWidth[nextSlideIndex].width || 0 if (!width) { return