收藏
回答

swiper的卡顿问题

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

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

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

2 个回答

  • 社区技术运营专员-小柿子
    社区技术运营专员-小柿子
    2019-02-26

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

    2019-02-26
    有用
    回复 2
  • 유미
    유미
    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
    有用
    回复
登录 后发表内容