相关文章推荐
骑白马的西红柿  ·  ClassCastException if ...·  4 周前    · 
魁梧的开心果  ·  建设适应数智化变革的高水平社会信用体系·  3 月前    · 
冲动的野马  ·  光明区8179名学子今日参加中考_深圳光明网·  4 月前    · 
伤情的消防车  ·  RDS ...·  7 月前    · 
沉稳的墨镜  ·  心脑血管高峰论坛暨广州自然之友金弘健雾化疗养 ...·  1 年前    · 
Code  ›  swiper会鬼畜现象 | 微信开放社区
https://developers.weixin.qq.com/community/develop/doc/0002a85b3c4fa0c36cd8bae8659400
俊秀的面包
1 年前

交流专区
服务市场
微信学堂
文档
小程序
  • 常用主页

    小程序

    小游戏

    企业微信

    微信支付

  • 服务市场
    微信学堂
    文档
登录
公告列表
公告列表
收藏
分享

扫描小程序码分享

回答

置顶 swiper会鬼畜现象 精选 热门

. 2019-07-11 2581 浏览 问题模块: Bug反馈
框架类型 API/组件名称 基础库版本 swiper 7.0.4 2.7.3

- 当前 Bug 的表现(可附上截图)


- 预期表现


- 复现路径


- 提供一个最简复现 Demo

wxml页面:

< view class = "banner" >

< swiper class = "bannerswipers" autoplay = " {{ autoplay }} " current = " {{ currentSwiper }} " bindchange = "swiperChange" circular = " {{ circular }} " bindanimationfinish = "changeGoodsSwip" >

< block wx:for = " {{ imgs }} " wx:key = " {{ index }} " >

< swiper-item >

< image src = " {{ item . url }} " ></ image >

</ swiper-item >

</ block >

</ swiper >

<!-- 重置小圆点的样式 -->

< view class = "bannerdots flex alignC flexC" >

< block wx:for = " {{ imgs }} " wx:key = " {{ index }} " >

< view class = "bannerdot {{ index == currentSwiper ? ' banneractive' : '' }} " ></ view >

</ block >

</ view >

</ view >


js相关代码片段:


Page ({

data: {

imgs: [

{ url: '../images/banner1.png' },

{ url: '../images/banner2.png' },

{ url: '../images/banner3.png' }

],

imgSelect: [

{ url: '../images/c.png' , name: '订单开票' },

{ url: '../images/b.png' , name: '扫码开票' },

{ url: '../images/a.png' , name: '我的发票' }

],

currentSwiper: 0 ,

autoplay: true ,

circular: true ,

},

changeGoodsSwip : function ( detail ) {

if ( detail . detail . source == "touch" ) {

//当页面卡死的时候,current的值会变成0

if ( detail . detail . source == "touch" ) {

//防止swiper控件卡死

if ( this . data . currentSwiper == 0 && this . data . preIndex > 1 ) { //卡死时,重置current为正确索引

this . setData ({ currentSwiper: this . data . preIndex });

}

else { //正常轮转时,记录正确页码索引

this . setData ({ preIndex: this . data . currentSwiper });

}

}

}

},

swiperChange : function ( e ) {

this . setData ({

currentSwiper: e . detail . current

})

}

})


最后一次编辑于 2019-07-11
回答 关注问题 邀请回答
收藏

扫描小程序码分享

复制链接
关闭

请选择投诉理由

  • 广告内容
  • 违法违规
  • 恶意灌水内容
  • 其他

删除当前帖子

删除后帖子内容及评论将一并被删除,且不可恢复。

删除 取消
关闭

确定删除?

删除后不可恢复

取消 确定
关闭

关注“微信开放社区”公众号

关注后,可在微信内接收相应的重要提醒。

请使用微信扫描二维码关注 “微信开放社区” 公众号

关闭

反馈

 
推荐文章
骑白马的西红柿  ·  ClassCastException if loaded by different class loaders in OSGi runtime · Issue #5036 · eclipse-ee4j
4 周前
魁梧的开心果  ·  建设适应数智化变革的高水平社会信用体系
3 月前
冲动的野马  ·  光明区8179名学子今日参加中考_深圳光明网
4 月前
伤情的消防车  ·  RDS PostgreSQL的PASE插件(IVFFlat或HNSW算法)向量检索_云数据库 RDS(RDS)-阿里云帮助中心
7 月前
沉稳的墨镜  ·  心脑血管高峰论坛暨广州自然之友金弘健雾化疗养推广会在南昌举行_项目
1 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号