utoplay="auto"
interval="5000"
duration="500"
current="{{swiperCurrent}}"
bindchange="swiperChange"
class="swiper">
<view class="dots">
<block wx:for="{{slider}}" wx:key="unique">
<view class="dot{{index == swiperCurrent ? ' active' : ''}}">
.swiper-container{
position: relative;
height: 300rpx;
}
.swiper-container .swiper{
height: 300rpx;
width: 100%;
}
.swiper-container .swiper .img{
width: 100%;
height: 100%;
}
.swiper-container .dots{
position: absolute;
left: 0px;
right: 0px;
bottom: 20rpx;
display: flex;
justify-content: center;
}
.swiper-container .dots .dot{
margin: 0px 8rpx;
width: 14rpx;
height: 14rpx;
background: #fff;
border-radius: 8rpx;
transition: all 0.6s;
}
.swiper-container .dots .dot.active{
width: 24rpx;
background: #f80;
}
// pages/swipernew/swipernew.js
Page({
/**
- 页面的初始数据
*/
data: {
slider: [
{ picUrl: 'http://y.gtimg.cn/music/photo_new/T003R720x288M000000rVobR3xG73f.jpg' },{ picUrl: 'http://y.gtimg.cn/music/photo_new/T003R720x288M000000j6Tax0WLWhD.jpg' },{ picUrl: 'http://y.gtimg.cn/music/photo_new/T003R720x288M000000a4LLK2VXxvj.jpg' }
],swiperCurrent: 0,},swiperChange: function (e) {
console.log(e);
this.setData({
swiperCurrent: e.detail.current
})
}
})
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。