微信小程序轮播中的current_微信小程序轮播功能

————————————————

/* swiper {

height: 421.5rpx;

} */

swiper-item image {

width: 100%;

height: 100%;

}

.swiper-container{

width: 100%;

position: relative;

}

.swiper-container .swiper{

height: 300rpx;

}

.swiper-container .swiper .img{

width: 100%;

height: 100%;

}

————————————————

const app = getApp()

Page({

data: {

swiperCurrent: 0,

indicatorDots: true,

autoplay: true,

interval: 3000,//自动切换时间间隔

duration: 800,//滑动动画时长

circular: true,//是否采用衔接滑动

imgUrls: [

'../../img/index/1.jpeg',

'../../img/index/2.jpeg',

'../../img/index/3.jpeg'

]

},

//轮播图的切换事件

swiperChange: function (e) {

this.setData({

swiperCurrent: e.detail.current

})

//console.log(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]

})

},

})

————————————————

您可以选择一种方式赞助本站支付宝转账赞助

分享到各大网站

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值