diff --git a/src/components/carousel/carousel.vue b/src/components/carousel/carousel.vue index 6cc4331..dd7fd60 100644 --- a/src/components/carousel/carousel.vue +++ b/src/components/carousel/carousel.vue @@ -147,7 +147,8 @@ add (offset) { let index = this.currentIndex; index += offset; - if (index === this.slides.length) index = 0; + while (index < 0) index += this.slides.length; + index = index % this.slides.length; this.currentIndex = index; }, slide () { diff --git a/test/routers/carousel.vue b/test/routers/carousel.vue index b6f9ee8..a73652f 100644 --- a/test/routers/carousel.vue +++ b/test/routers/carousel.vue @@ -19,6 +19,9 @@ 2 + + Push + test3 + + {{item}} +