mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
26 lines
644 B
Vue
26 lines
644 B
Vue
<template>
|
|
<div class="flex flex-row flex-wrap gap-2 justify-center">
|
|
<button
|
|
v-for="(_, i) in amount"
|
|
@click="() => slideTo(i)"
|
|
:class="[
|
|
carousel.currentSlide == i ? 'bg-blue-600 w-6' : 'bg-zinc-700 w-3',
|
|
'transition-all cursor-pointer h-2 rounded-full',
|
|
]"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { injectCarousel } from "vue3-carousel";
|
|
|
|
const carousel = inject(injectCarousel)!!;
|
|
|
|
const amount = carousel.maxSlide - carousel.minSlide + 1;
|
|
|
|
function slideTo(index: number) {
|
|
const offsetIndex = index + carousel.minSlide;
|
|
carousel.nav.slideTo(offsetIndex);
|
|
}
|
|
</script>
|