收藏
回答

swiper写的一个轮播图,图片切换特别快(闪),怎么处理

框架类型 操作系统 工具版本
小程序 Windows 1.02.1803150

想要在界面中实现一个轮播图的功能,每个文件的代码实现如下


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%;

}


如上完成后,轮播图有了,但是轮播图的图片切换不是设置的时间,呈现了切换特别快(快到闪屏的效果了),不知道什么原因,求解!!!



回答关注问题邀请回答
收藏

3 个回答

  • 陈
    2018-03-23

    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);


    2018-03-23
    有用
    回复 1
    • Alan
      Alan
      01-18
      这个该放在哪个文件中呢
      01-18
      回复
  • 嘟嘟
    嘟嘟
    2018-03-21

    谢谢1楼,OK了

    2018-03-21
    有用
    回复
  • 旭良(倒纱,倒丝+收杂纱)
    旭良(倒纱,倒丝+收杂纱)
    2018-03-21

    <swiper indicator-dots='{{indicatorDots}}' autoplay='{{autoplay}}' interval='{{interval}}' duration='{{duration}}'>

    看看有什么不一样。

    2018-03-21
    有用
    回复
登录 后发表内容