想要在界面中实现一个轮播图的功能,每个文件的代码实现如下
__
__
WXMl文件:
<swiper indicator-dots=‘indicatorDots’ autoplay=‘autoplay’ interval=‘interval’ duration=‘duration’>
<block wx:for="{{imgUrls}}">
<swiper-item>
<image src=’{{item}}’></image>
</swiper-item>
</block>
</swiper>
JS:
data: {
imgUrls: [
‘http:\/\/mz.djmall.xmisp.cn\/files\/banner\/20161219\/148211980641.png’,
‘http:\/\/mz.djmall.xmisp.cn\/files\/banner\/20161222\/148238831285.png’,
‘http:\/\/mz.djmall.xmisp.cn\/files\/banner\/20161222\/14823895573.png’
],
indicatorDots: true, //是否显示面板指示点
autoplay: true, //是否自动切换
interval: 6000, //自动切换时间间隔,3s
duration: 3000, // 滑动动画时长1s
},
WXSS:
swiper {
height: 320rpx;
background-color: #AAD0Dc;
}
swiper-item image {
width: 100%;
height: 100%;
}
如上完成后,轮播图有了,但是轮播图的图片切换不是设置的时间,呈现了切换特别快(快到闪屏的效果了),不知道什么原因,求解!!!
var curDate = new Date();
var year = curDate.getFullYear();
var month = curDate.getMonth() + 1;
var day = curDate.getDate();
var year1 = curDate.getHours();
var month1 = curDate.getMinutes() ;
var day1 = curDate.getSeconds();
console.log("当前时间年月日" + year + "-" + month + "-" + day );
console.log("当前时间时分秒" + year1 + "-" + month1 + "-" + day1);