zoukankan      html  css  js  c++  java
  • 小程序修改swiper小圆点

    <view class='hot-box'>
        <view class='hot-header'>
          <view class='header-e'>GLOTHING</view>
          <view class='header-c'>热门</view>
        </view>
        <view class="dots">
          <block wx:for="{{img}}" wx:key="unique">
            <view class="dot{{index == swiperCurrent ? ' active' : ''}}"></view>
          </block>
        </view>
        <view class='hot-swiper'>
          <swiper class='swiper' circular current="{{swiperCurrent}}" bindchange="swiperChange" class="swiper">
            <block wx:for="{{img}}" wx:key="{{*this}}">
              <swiper-item>
                <image src="{{item.src}}" class="slide-image" />
              </swiper-item>
            </block>
          </swiper>
        </view>
      </view>
    .hot-box .wx-swiper{
      background-color: #000;
    }
    .hot-box .dots{
      display: flex;
      justify-content: center;
      margin-bottom: 50rpx;
    }
    .hot-box .dots .dot{
      margin: 0 8rpx;
      width: 14rpx;
      height: 14rpx;
      background: #fff;
      border-radius: 8rpx;
      background-color: #b0b0b0;
    }
    .hot-box .dots .dot.active{
      width: 14rpx;
      background: #000;
    }
    //index.js
    //获取应用实例
    const app = getApp()
    
    Page({
      data: {
        img: [{
            "src": 'https://upload-images.jianshu.io/upload_images/12893060-11b6be97a02c1e5c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240'
          },
          {
            "src": 'https://upload-images.jianshu.io/upload_images/12893060-11b6be97a02c1e5c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240'
          },
          {
            "src": 'https://upload-images.jianshu.io/upload_images/12893060-11b6be97a02c1e5c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240'
          }
        ],
        swiperCurrent: 0,
      },
      onLoad: function() {
    
      },
      swiperChange: function(e) {
        this.setData({
          swiperCurrent: e.detail.current
        })
      }
    })

    就是模拟一个。

    参考  https://blog.csdn.net/rorntuck7/article/details/54378963

  • 相关阅读:
    矩阵树定理 / 生成树计数
    NC20811 蓝魔法师 (树形DP/树上01背包)
    Xor-MST学习/ 2020牛客暑假多校(五)B.Graph
    HDU-6820 Tree (2020杭电多校(五) 1007)
    Flipping Coins (概率DP)
    宝石装箱 容斥+dp
    Rabbit的工作(1) (dP)
    Codeforces-1350 E.Orac and Game of Life
    HDU-6563 Strength (贪心)
    HDU-6558 The Moon (期望DP)
  • 原文地址:https://www.cnblogs.com/baifubin/p/9343133.html
Copyright © 2011-2022 走看看