123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <div class="simple-swiper">
- <swiper ref="mySwiper" :options="swiperOptions">
- <swiper-slide v-for="(item, index) in imageList" :key="index">
- <div class="slide"><img class="image" :src="item" /></div>
- </swiper-slide>
- </swiper>
- </div>
- </template>
- <script>
- import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
- export default {
- components: {
- Swiper,
- SwiperSlide,
- },
- directives: {
- swiper: directive,
- },
- props: {
- imageList: {
- type: Array,
- default: () => [],
- },
- },
- data() {
- return {
- swiperOptions: {
- autoplay: true,
- },
- }
- },
- computed: {
- swiper() {
- return this.$refs.mySwiper.$swiper
- },
- },
- mounted() {
- console.log('Current Swiper instance object', this.swiper)
- },
- }
- </script>
- <style scoped lang="scss">
- .simple-swiper {
- width: 100%;
- height: 100%;
- overflow: hidden;
- .image {
- display: block;
- width: 100%;
- height: 100%;
- }
- }
- </style>
|