ImageSwiper.vue 684 B

12345678910111213141516171819202122232425262728293031323334
  1. <template>
  2. <Carousel
  3. v-bind="carouselConfig"
  4. @slide-end="(i) => $emit('switch', i)"
  5. >
  6. <Slide v-for="(slide, index) in items" :key="index">
  7. <slot name="item" :index="index" :item="slide" />
  8. </Slide>
  9. <template #addons>
  10. <Navigation />
  11. <Pagination />
  12. </template>
  13. </Carousel>
  14. </template>
  15. <script setup lang="ts">
  16. import type { PropType } from 'vue';
  17. import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'
  18. defineEmits([
  19. "switch"
  20. ])
  21. const props = defineProps({
  22. items : {
  23. type: Object as PropType<Array<any>>,
  24. default: () => ([]),
  25. },
  26. })
  27. const carouselConfig = {
  28. wrapAround: true,
  29. ...props,
  30. }
  31. </script>