美文网首页
小程序swiper卡死

小程序swiper卡死

作者: 无名小码农 | 来源:发表于2019-05-27 10:18 被阅读0次

    小程序swiper滑动卡死问题

    原因可能是swiper组件内部问题,当无法响应用户快速翻动动作时,当前页变量current无法变更为正确页码索引,而是被置为0,
        console.log(e.detail.current);
        if (e.detail.source == "touch") {
          //防止swiper控件卡死
          if (this.data.current == 0 && this.data.dailySpikeIndex > 1) {//卡死时,重置current为正确索引
            this.setData({ dailySpikeIndex: this.data.dailySpikeIndex });
          }
          else {//正常轮转时,记录正确页码索引
            this.setData({ dailySpikeIndex: e.detail.current });
          }
        }
      },

    相关文章

      网友评论

          本文标题:小程序swiper卡死

          本文链接:https://www.haomeiwen.com/subject/bdsctctx.html