zoukankan      html  css  js  c++  java
  • 小程序之修改轮播图的小点样式

    小程序之修改轮播图的小点样式

    1、单独写一个小点的元素。

    <view class='swiper-box'>
        <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" bindchange="swiperChange">
          <block wx:for="{{imgUrls}}">
            <swiper-item>
              <image src="{{item}}" class="slide-image" />
            </swiper-item>
          </block>
        </swiper>
        <view class="dots">  
          <block wx:for="{{imgUrls}}" wx:key="unique">  
            <view class="dot{{index == swiperCurrent ? ' active' : ''}}"></view>  
          </block>  
        </view>
      </view>
    

      

    2、将轮播图组件自带的小点隐藏

    indicatorDots: false
    

      

    3、修改样式

    swiper{
       100%;
    }
    
    .swiper-box{
      position: relative;
       100%;
    }
    .dots{  
      position: absolute;  
      left: 0;  
      right: 0;  
      bottom: 20rpx;  
      display: flex;  
      justify-content: center;  
    }  
    .dots .dot{  
      margin: 0 8rpx;  
       14rpx;  
      height: 14rpx;  
      background: #fff;  
      border-radius: 8rpx;  
      transition: all .6s;  
    }  
    .dots .dot.active{  
       24rpx;  
      background: #f80;  
    } 
    
    swiper image {
       100%;
      height: 100%;
    }
    

      

  • 相关阅读:
    moment.js相关知识总结
    git相关使用解释
    .我的第一篇博客
    QT项目配置
    重载->
    内核对象同步
    模式对话框与非模式对话框
    显示与隐式类型转换
    size_t与size_type
    系统级源代码:系统裁剪
  • 原文地址:https://www.cnblogs.com/momozjm/p/8609728.html
Copyright © 2011-2022 走看看