最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

小程序自定義輪播圖圓點組件

 更新時間:2022年06月24日 16:43:11   作者:dreamimport  
這篇文章主要為大家詳細介紹了小程序自定義輪播圖圓點組件,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了小程序自定義輪播圖圓點組件的具體代碼,供大家參考,具體內容如下

微信小程序自帶的輪播圖小點,是一個圓點且在圖片上展示,不美觀。上圖為自定義后的輪播圖效果

代碼如下:

wxhtml:

<!-- 輪播圖 -->
? ? <view class="lbt">
? ? ? <swiper class="banner-list" style="height:100%;" circular="{{circular}}" indicator-dots='' autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" bindchange="swiperChange">?
? ? ? ? <block wx:for="{{imgUrls}}" wx:key='{{item.id}}'>
? ? ? ? ? <swiper-item>
? ? ? ? ? ? <image src="{{urls}}{{item.image}}" class="slide-image" width="100%" />
? ? ? ? ? </swiper-item>
? ? ? ? </block>
? ? ? </swiper>
? ? ? <!-- 這里是自定義控制組件的模塊 -->
? ? ? <view class="dots">
? ? ? <block wx:for="{{imgUrls}}" wx:key="{{item.id}}">
? ? ? <!-- 循環(huán)圖片張數有多少張圖片就有多少個小點 -->
? ? ? <view class="dot{{index == swiperCurrent ? ' active' : ''}}"></view>
? ? ? </block>
? ? ? </view>
? ? </view>
? </view>

wxjs:

// 輪播圖片改變時,小圓點也改
? swiperChange: function (e) {
? ? this.setData({
? ? ? swiperCurrent: e.detail.current
? ? })
? },

wxcss:

.lbt {
? position: relative;
? width: 100%;
? height: 300rpx;
? padding: 30rpx;
? box-sizing: border-box;
? border-radius: 10rpx;
}
.lbt .dots{
position: absolute;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
}
.lbt .dots .dot{
margin: 0 6rpx;
width: 18rpx;
height: 10rpx;
background: #A2A2A2;
border-radius: 6rpx;
transition: all .6s;
}
.lbt .dots .dot.active{
width: 30rpx;
height: 10rpx;
background:#3d3d3d;
}

.slide-image {
? width: 100%;
? height: 100%;
? border-radius: 10rpx;
}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

最新評論

南投市| 盱眙县| 泊头市| 金昌市| 安泽县| 晋州市| 肇庆市| 襄城县| 安岳县| 宜宾市| 新竹县| 阿尔山市| 烟台市| 鄱阳县| 台南县| 武定县| 陕西省| 吉安市| 拉孜县| 隆昌县| 迁安市| 绵阳市| 海原县| 道孚县| 泰兴市| 汽车| 绿春县| 荥阳市| 红河县| 修文县| 博客| 玛沁县| 金川县| 罗江县| 黄龙县| 雅江县| 巴南区| 乾安县| 山阴县| 山丹县| 遂宁市|