Skip to content

Commit

Permalink
fix(Carousel): pages calculation (#2345)
Browse files Browse the repository at this point in the history
Co-authored-by: Edmund Chaplin <edmund.chaplin@zaros.co.uk>
  • Loading branch information
EdmundChaplin and Edmund Chaplin authored Oct 9, 2024
1 parent 6895b5d commit 5cf24fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/runtime/components/elements/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ export default defineComponent({
return 0
}
return props.items.length - Math.round(carouselWidth.value / itemWidth.value) + 1
const itemDivisions = Math.round(carouselWidth.value / itemWidth.value)
if (props.items.length <= itemDivisions) {
return 0
}
return props.items.length - itemDivisions + 1
})
const isFirst = computed(() => currentPage.value <= 1)
Expand Down

0 comments on commit 5cf24fa

Please sign in to comment.