在开发过程中有3D轮播图的需求,使用vue-awesome-swiper完成
先贴个效果图
<template>
<div class="box">
<swiper :options="swiperOption" ref="mySwiper">
<swiper-slide v-for="(item, index) of 5" :key="index">
<!-- <img class="swiper-img" :src="url + item.img" /> -->
</swiper-slide>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</div>
</template>
<script>
export default {
data() {
return {
swiperOption: {
loop: true,
effect: "coverflow",
grabCursor: true,
centeredSlides: true,
slidesPerView: 1.2,
coverflowEffect: {
rotate: 0,
stretch: 80,
depth: 150,
modifier: 1,
slideShadows: true,
},
observer: true,
observeParents: true,
},
};
},
};
</script>
<style>
.box{
width: 375px;
height: 678px;
background: skyblue;
margin: 0 auto;
}
.swiper-container {
width: 375px;
height: 150px;
}
.swiper-slide {
background-color: aqua;
}
</style>