Skip to content

Commit

Permalink
fix(carousel): fix repeat index
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek committed Feb 1, 2024
1 parent 13b0d37 commit 62ec752
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/oruga-next/src/components/carousel/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ function onNext(): void {
}
function switchTo(index: number, onlyMove?: boolean): void {
if (settings.value.repeat) index = mod(index, total.value + 1);
if (settings.value.repeat) index = mod(index, total.value);
index = bound(index, 0, total.value);
scrollIndex.value = index;
Expand Down Expand Up @@ -411,8 +411,7 @@ function startTimer(): void {
if (!props.autoplay || timer.value) return;
isPaused.value = false;
timer.value = setInterval(() => {
if (!props.repeat && activeIndex.value >= childItems.value.length - 1)
pauseTimer();
if (!props.repeat && !hasNext.value) pauseTimer();
else onNext();
}, props.interval);
}
Expand Down

0 comments on commit 62ec752

Please sign in to comment.