From ef103e0e34a32b0ac7b72b18c2a16760af422872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Wed, 10 Aug 2022 16:02:33 +0300 Subject: [PATCH] Fixed #2356 - Carousel autoplay not working with static data --- src/components/carousel/Carousel.vue | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/components/carousel/Carousel.vue b/src/components/carousel/Carousel.vue index 4b0acf1c4..2daf420a1 100755 --- a/src/components/carousel/Carousel.vue +++ b/src/components/carousel/Carousel.vue @@ -389,12 +389,37 @@ export default { } }, mounted() { + let stateChanged = false; this.createStyle(); this.calculatePosition(); if (this.responsiveOptions) { this.bindDocumentListeners(); } + + if (this.isCircular()) { + let totalShiftedItems = this.totalShiftedItems; + + if (this.d_page === 0) { + totalShiftedItems = -1 * this.d_numVisible; + } + else if (totalShiftedItems === 0) { + totalShiftedItems = -1 * this.value.length; + if (this.remainingItems > 0) { + this.isRemainingItemsAdded = true; + } + } + + if (totalShiftedItems !== this.totalShiftedItems) { + this.totalShiftedItems = totalShiftedItems; + + stateChanged = true; + } + } + + if (!stateChanged && this.isAutoplay()) { + this.startAutoplay(); + } }, updated() { const isCircular = this.isCircular();