fix(Carousel): pages calculation (#2345)

Co-authored-by: Edmund Chaplin <edmund.chaplin@zaros.co.uk>
This commit is contained in:
EdmundChaplin
2024-10-09 14:54:38 +01:00
committed by GitHub
parent 6895b5d443
commit 5cf24fa6e7

View File

@@ -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)