小程序 轮播图

小程序 轮播图轮播图:cssswiper{height:400rpx;}swiper-itemimage{width:100%;height:100%;}.swiper-container{position:relative;margin-top:-300rpx;}.swiper-container.swiper{height:300r…

大家好,又见面了,我是你们的朋友全栈君。

轮播图

css

swiper {

height: 400rpx;

}

swiper-item image {

width: 100%;

height: 100%;

}

.swiper-container{

position: relative;

margin-top:-300rpx;

}

.swiper-container .swiper{

height: 300rpx;

}

.swiper-container .swiper .img{

width: 90%;

height: 100%;

margin: 0 5%;

border-radius: 20rpx;

}

xml

 

<view class="swiper-container">

  <swiper indicator-dots="{
  
  {indicatorDots}}" autoplay="{
  
  {autoplay}}" indicator-color="{
  
  {indicatorCo}}" indicator-active-color="{
  
  {indicatoraAC}}" interval="{
  
  {interval}}" duration="{
  
  {duration}}" circular="{
  
  {duration}}" current="{
  
  {swiperCurrent}}" bindchange="swiperChange" class="swiper">

    <block wx:for="{
  
  {imgUrls}}" wx:key="unique">

      <swiper-item>

        <image src="{
  
  {item}}" class="img" bindtap="swipclick" mode="aspectFill"/>

      </swiper-item>

    </block>

  </swiper>
  

</view>

js

Page({

  data: {

    swiperCurrent: 0,

    indicatorDots: true,

    autoplay: true,

    interval: 3000,

    duration: 800,

    circular: true,

    indicatorCo:"#ffdfdc",

    indicatoraAC:"#ff948a",

    imgUrls: [

      'http://life.southmoney.com/tuwen/UploadFiles_6871/201805/20180531142617331.jpg',

      'http://life.southmoney.com/tuwen/UploadFiles_6871/201805/20180531142617331.jpg',

      'http://life.southmoney.com/tuwen/UploadFiles_6871/201805/20180531142617331.jpg'

    ],

    links: [

      '../user/user',

      '../user/user',

      '../user/user'

    ]


  },

  //轮播图的切换事件

  swiperChange: function (e) {

    this.setData({

      swiperCurrent: e.detail.current

    })

  },

  //点击指示点切换

  chuangEvent: function (e) {

    this.setData({

      swiperCurrent: e.currentTarget.id

    })

  },

  //点击图片触发事件

  swipclick: function (e) {

    console.log(this.data.swiperCurrent);

    wx.switchTab({

      url: this.data.links[this.data.swiperCurrent]

    })

  }

})

 

效果图(不会录频啊  有小伙伴告诉我吗  哈哈哈哈)

 

小程序 轮播图

 

swiper小圆点 默认样式修改  (以下代码  上面都有  这里只是做个截屏说明一下)

xml

小程序 轮播图

                                                                                                图1

 

js

 

小程序 轮播图                                                                                                                             图2

 

API

小程序 轮播图

                                                                                               图3

 

 

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/143139.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 系统调用(int 0x80)详解

    系统调用(int 0x80)详解1、系统调用初始化在系统启动时,会在sched_init(void)函数中调用set_system_gate(0x80,&system_call),设置中断向量号0x80的中断描述符:#defineset_system_gate(n,addr) _set_gate(&idt[n],15,3,addr)其中15表示此中断号对应的是陷阱门,注意,这个中断向量不是中断门描述符

    2025年11月6日
    2
  • HUAWEI Mate40Pro解除账号忘记密码ID强制刷机鸿蒙系统激活锁能解开吗

    HUAWEI Mate40Pro解除账号忘记密码ID强制刷机鸿蒙系统激活锁能解开吗华为Mate40pro账号锁过程需要准备一下工具:windwos系统电脑一台(有条件可以准备配置好点的电脑,可以有效提高解锁效率)。 准备Tpye-c数据线一根(一拖三的数据线不行),其他品牌的数据线也可以。 电脑下载todesk远程控制软件,(进行电脑远程救援)。 安装专业USB端口镜像工具。 关注【刷机爱好者】微信公众账号,获取更多帮助!本次教程简要及目录第一步:将用户电脑USB镜像到我的电脑,进行USB1.0模式底层烧录。第二步:底层烧录完成,成功获取临时权限,手机自动进入fas.

    2022年6月15日
    650
  • 腾讯收购冰川网络_冰河是谁

    腾讯收购冰川网络_冰河是谁应朋友的邀约,不久前去腾讯交流学习了。这次的收获还是蛮大的,今天,跟小伙伴们分享下这次去腾讯交流和学习的体会。

    2022年8月22日
    10
  • Python中线程同步与线程锁「建议收藏」

    Python中线程同步与线程锁「建议收藏」文章目录Python中线程同步与线程锁线程同步threading.Event对象threading.Timer定时器,延迟执行threading.Lock锁可重入锁RLockCondition条件锁,等待通知therading.Semaphore信号量threading.BoundedSemaphore有界信号量Python中线程同步与线程锁线程同步概念*线程同步,线程间协同,通过某种技…

    2022年6月21日
    31
  • TP5与TP3.X对比

    TP5与TP3.X对比

    2021年10月12日
    41
  • C语言实践(2016级第5周):编程思维启蒙

    C语言实践(2016级第5周):编程思维启蒙

    2022年2月21日
    36

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号