這篇文章主要介紹了微信小程序如何實現(xiàn)一個swiper,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

HTML
<swiper class="swiper-block" previous-margin="70rpx" next-margin="70rpx" current="0" autoplay="true" bindchange="swiperChange" circular="true">
<block wx:for="{{totalData.banners}}" wx:index="{{index}}" wx:key="bannerList">
<swiper-item class="swiper-item">
<image mode="aspectFill" src="{{item.cover}}" class="slide-image {{swiperIndex == index ? 'active' : ''}}" /> <br> </swiper-item>
</block>
</swiper>css
.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,
})
},感謝你能夠認真閱讀完這篇文章,希望小編分享的“微信小程序如何實現(xiàn)一個swiper”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識等著你來學習!
當前題目:微信小程序如何實現(xiàn)一個swiper-創(chuàng)新互聯(lián)
鏈接地址:http://www.chinadenli.net/article24/djhgje.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、企業(yè)網(wǎng)站制作、ChatGPT、靜態(tài)網(wǎng)站、品牌網(wǎng)站制作、移動網(wǎng)站建設
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容