1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| <template> <div class="example-3d"> <swiper class="swiper" :options="swiperOption"> <swiper-slide v-for="(item, index) in colorList" :key="index" :style="'background: '+item">Slide {{index}}</swiper-slide> </swiper> </div> </template>
<script> import { Swiper, SwiperSlide } from 'vue-awesome-swiper' import 'swiper/css/swiper.css'
export default { name: 'swiper-example-3d-coverflow', title: '3D Coverflow effect', components: { Swiper, SwiperSlide, }, data() { return { colorList:['#c82829','#f5871f','#eab700','#718c00','#3e999f'], swiperOption: { initialSlide: 1, virtualTranslate: true, effect: 'coverflow', grabCursor: false, centeredSlides: true, slidesPerView: 'auto', coverflowEffect: { rotate: 10, stretch: 0, depth: 10, modifier: 1, slideShadows: false, }, on: { click: function (swiper, event) {
}, }, slideToClickedSlide: true, slidesPerView: 5, }, } }, } </script>
<style lang="scss" scoped> .example-3d { width: 100%; height: 400px; padding-top: 50px; padding-bottom: 50px; }
.swiper { height: 100%; width: 100%;
.swiper-slide { display: flex; justify-content: center; align-items: center; width: 300px; height: 300px; text-align: center; font-weight: bold; background-color: #2c8dfb; background-position: center; background-size: cover; } } </style>
|