收藏
回答

swiper的卡顿问题

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug swiper 工具 6.7.4 2.6.1

swiper 来回左右滑动,滑动7,8次,就会卡死,官方的demo也一样,也会卡死

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

3 个回答

  • 禾店短剧系统
    禾店短剧系统
    2021-06-09

    思路不对吧,这个跟图片是网络读取的还是本地提取的关系不大,应该是图片的渲染过程。你先这么做,整个页面里,使用纯净的swiper把容器写出来,再循环swiper-item数组,图片组件是images mode="widthFix",其他的一切对swiper的操作或事件脚本去掉,不监听滚动条

    2021-06-09
    有用 1
    回复
  • 2019-03-30



    郁闷啊,

    <swiper class="swiper" current="{{currentTab}}" duration="200" bindchange="swiperChange" bindanimationfinish="animationfinish">
            <swiper-item>
                <view id="fist-swiper-item">我是tab1---- index =1</view>
            </swiper-item>
            <swiper-item>
                <view>我是tab2---- index =2</view>
            </swiper-item>
            <swiper-item>
                <view>我是tab3---- index =3</view>
            </swiper-item>
            <swiper-item>
                <view>我是tab4---- index =4</view>
            </swiper-item>
            <swiper-item>
                <view>我是tab5----index = 5</view>
            </swiper-item>
        </swiper>
    // swiper 滑动切换
      swiperChange(e) {
        console.log(e.detail.current, 'e.detail.current', e.detail, 'e.detail~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
        console.log(this.data.currentTab, '原来 this.data.currentTab-swiperChange~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`')
        var that = this
        if (e.detail.source == 'touch') {
          if (e.detail.current == 0 && that.data.currentTab > 1) {
            that.setData({
              currentTab: that.data.currentTab
            })
          } else if (e.detail.current == 0 && that.data.currentTab == 1) {
            wx.createSelectorQuery().select('#fist-swiper-item').boundingClientRect(function (rect) {
              //rect.id // 节点的ID
              //rect.dataset // 节点的dataset
              //rect.left // 节点的左边界坐标
              console.log(rect.left)
            }).exec()
            console.log(e)
            that.setData({
              currentTab: e.detail.current
            })
          } else {
            that.setData({
              currentTab: e.detail.current
            })
          }
        }
      },


    2019-03-30
    有用
    回复
  • 是小白啊
    是小白啊
    2019-02-26

    swiper组件在持续优化中,感谢反馈

    2019-02-26
    有用
    回复 4
    • か不良人か
      か不良人か
      2019-02-26

      17年就开始有人提,到现在还在优化,也是够可以的

      2019-02-26
      回复
    • か不良人か
      か不良人か
      2019-02-26回复か不良人か

      官方大佬,卡死是个很严重的问题啊

      2019-02-26
      回复
    • TUTUSONG
      TUTUSONG
      2020-11-19
      请问这个问题有后续不 现在卡顿还是很容易复现滴
      2020-11-19
      回复
    • Enzo🌨
      Enzo🌨
      2021-04-13
      请问是否有优化方案?
      2021-04-13
      回复
登录 后发表内容