Skip to content

Commit ae9479d

Browse files
committed
refactor: simplify transition callback logic in Carousel component
1 parent 605ed25 commit ae9479d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/components/Carousel/Carousel.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -514,16 +514,14 @@ export const Carousel = defineComponent({
514514
emit('update:modelValue', mappedIndex)
515515

516516
const transitionCallback = (): void => {
517-
if (config.wrapAround) {
518-
if (mappedIndex !== targetIndex) {
519-
modelWatcher.resume()
520-
521-
currentSlideIndex.value = mappedIndex
522-
emit('loop', {
523-
currentSlideIndex: currentSlideIndex.value,
524-
slidingToIndex: slideIndex,
525-
})
526-
}
517+
if (config.wrapAround && mappedIndex !== targetIndex) {
518+
modelWatcher.resume()
519+
520+
currentSlideIndex.value = mappedIndex
521+
emit('loop', {
522+
currentSlideIndex: currentSlideIndex.value,
523+
slidingToIndex: slideIndex,
524+
})
527525
}
528526

529527
emit('slide-end', {

0 commit comments

Comments
 (0)