本篇文章小编给大家分享一下微信小程序实现一个简单swiper代码实例,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
截图
HTML
.swiper-block { height: 320rpx; width: 100%; } .swiper-item { display: flex; flex-direction: column; justify-content: center; align-items: center; overflow: unset; text-align: center; } .slide-image { height: 230rpx; width: 526rpx; border-radius: 10rpx; box-shadow: 0px 3px 10px 0px rgba(51, 51, 51, 0.3); margin: 0 rpx 30rpx; z-index: 1; } .active { transform: scale(1.21); transition: all 0.2s ease-in 0s; z-index: 20; }
js
swiperChange(e) { const that = this; that.setData({ swiperIndex: e.detail.current, }) },