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

微信小程序修改swiper默認(rèn)指示器樣式的實(shí)例代碼

 更新時(shí)間:2018年07月18日 09:40:23   作者:還有星星  
這篇文章主要介紹了微信小程序修改swiper默認(rèn)指示器樣式的實(shí)例代碼,代碼塊是從微信開發(fā)文檔中心復(fù)制的代碼塊,在此基礎(chǔ)上修改官方swiper樣式,需要的朋友可以參考下

修改官方swiper樣式

從微信官方微信開發(fā)文檔中心復(fù)制swiper 代碼塊。

wxml定義

<view class="wrap">
 <swiper class="swipers" autoplay="{{autoplay}}" current="{{currentSwiper}}" bindchange="swiperChange"> 
  <block wx:for="{{imgUrls}}"> 
   <swiper-item> 
     <image src="{{item}}" class="slide-image" width="100%" height="150" ></image> 
   </swiper-item> 
  </block> 
 </swiper> 
 <!--重置小圓點(diǎn)的樣式 -->
 <view class="dots"> 
  <block wx:for="{{imgUrls}}"> 
   <view class="dot{{index == currentSwiper ? ' active' : ''}}"></view> 
  </block> 
 </view> 
</view>

wxss定義樣式

.wrap {
 height: auto;
 position: relative;
 width: 100%;
}
.swipers {
 height: 350rpx;
 width: 100%;
}
.slide-image {
 display: block;
 width: 100%;
 height: 100%;
}
/*用來包裹所有的小圓點(diǎn) */
.dots {
 width: 156rpx;
 height: 36rpx;
 display: flex;
 flex-direction: row;
 position: absolute;
 left: 320rpx;
 bottom: 20rpx;
}
/*未選中時(shí)的小圓點(diǎn)樣式 */
.dot {
 width: 26rpx;
 height: 26rpx;
 border-radius: 50%;
 margin-right: 26rpx;
 background-color: white;
}
/*選中以后的小圓點(diǎn)樣式 */
.active {
 width: 26rpx;
 height: 26rpx;
 background-color: coral;
}

賦值

Page({
 data: {
 imgUrls: [
  'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
  'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
  'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
 ],
 currentSwiper: 0,
 autoplay: true
 },
 swiperChange: function (e) {
 this.setData({
  currentSwiper: e.detail.current
 })
 }
}) 

效果圖:

這里寫圖片描述

總結(jié)

以上所述是小編給大家介紹的微信小程序修改swiper默認(rèn)指示器樣式的實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論

都兰县| 锡林浩特市| 阿瓦提县| 和顺县| 安溪县| 定安县| 边坝县| 八宿县| 红原县| 上林县| 山东省| 怀来县| 武山县| 富蕴县| 平果县| 武汉市| 吴桥县| 定安县| 民县| 深水埗区| 仁布县| 彰化市| 青岛市| 英吉沙县| 大埔县| 介休市| 信阳市| 塔城市| 宝清县| 沈阳市| 库尔勒市| 塔河县| 井冈山市| 武定县| 秦皇岛市| 汉川市| 丹江口市| 八宿县| 定兴县| 五寨县| 且末县|