Showing multiple images in Vue3-carousel

I’ve searched the web far and wide for answers, but to no avail.

Could a kind soul please explain to me, a novice, how I get three separate images shown using Vue3-carousel?

I’ve had a look at the Vue3-carousel docs, but if the solution is there, I’m not seeing it.

<template>
  <section class="productOverview">
    <Carousel :itemsToShow="3" :wrapAround="true">
      <Slide v-for="slide in 3" :key="slide">
        <div class="carousel__item">{{ slide }}</div>
      </Slide>
    </Carousel>
  </section>
</template>

I assume the magic happens somewhere in the script area…

<script>
 import { defineComponent } from "vue";
 import { Carousel, Slide } from "vue3-carousel";
 import "vue3-carousel/dist/carousel.css";
    
 export default defineComponent({
  name: "Autoplay",
  components: {
    Carousel,
    Slide,
  },
});
</script>

Thanks in advance.

Answer

Try to create data object with your images url’s:

export default defineComponent({
  name: "Autoplay",
  components: {
    Carousel,
    Slide,
  },
  data() {
    return {
      images: [{id: 1,url:'img1url'}, {id: 2,url:'img2url'}, {id: 3,url:'img3url'}]
    }
  }

Then i template loop thru images

 <Slide v-for="(image, index) in images" :key="image.id">
    <img :src="getImage(image.url)" />
    <button v-if="slidesCount > 1" @click="deleteImage(index)">x</button>
  </Slide>

Method for images:

methods: {
  getImage(imagePath) {
    return require(imagePath);
  }
}