vue轮播
css样式:
.my-swiper{
overflow: hidden;
width: 100%;
height: 50vw;
position: relative;
background: #dddddd;
}
.swiper-item{
width: 50%;
height: 50%;
transition: all 1s;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
opacity: 0;
margin: auto;
z-index: 0;
}
.swiper-item.active{
opacity: 1;
z-index: 9;
}
.swiper-item.prev{
opacity: 0.8;
transform: translateX(-100%) scale(0.8);
}
.swiper-item.next{
opacity: 0.8;
transform: translateX(100%) scale(0.8);
}
.swiper-item img{
width: 100%;
height: 100%;
}
模板语法:
<div class=“my-swiper” @click=“changeActive”>
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/741dee821c8bface6913da575ad697b7.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/214386d4a56c5e05598461e8f01ba5f4.png)
方法:
![第一](https://i-blog.csdnimg.cn/blog_migrate/5071e8452e4927edc8b2ac55594be1fc.jpeg)