收藏
回答

scroll-view bindscroll

操作系统 操作系统版本 手机型号 微信版本
Android 4以上 红米note3 6.5.23

scroll-view  中使用 bindscroll,

就是滚动时候获取 scrollTop 的值,


多个判断 , 对应去改变导航菜单 显示的样式,会有卡顿,

如:

if (scrollTop < 515) {

      // console.log(11111111111)

      that.setData({

        monthactiveKey: 1

      })

      return;

    }

    if (scrollTop > 515 && scrollTop < 1030) {

      // console.log(222222222)

      that.setData({

        monthactiveKey: 2

      })

      return;

    }


页滚动的上面设置值范围的时候,对用导航显示的样式需要10s左右才会响应,很卡




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

9 个回答

  • 両儀式          ༽
    両儀式 ༽
    2018-07-29

    我也是这样的问题~

    2018-07-29
    有用
    回复
  • You can you up
    You can you up
    2017-12-28

    if (scrollTop < 515 && that.data.monthactiveKey==2) {

          // console.log(11111111111)

          that.setData({

            monthactiveKey: 1

          })

          return;

        }

        if (scrollTop > 515 && scrollTop < 1030 && that.data.monthactiveKey==1) {

          // console.log(222222222)

          that.setData({

            monthactiveKey: 2

          })

          return;

        }


    这么写会不会好点

    2017-12-28
    有用
    回复
  • 睡前原谅一切
    睡前原谅一切
    2017-12-27

    先下班走了。

    2017-12-27
    有用
    回复
  • 睡前原谅一切
    睡前原谅一切
    2017-12-27

    你的不用scroll-view不行吗?或者还是这个onPageScroll监听不到scroll-view的滚动高度。我没试过

    2017-12-27
    有用
    回复 1
    • 両儀式          ༽
      両儀式 ༽
      2018-07-30

      一样的问题 有解决吗~

      2018-07-30
      回复
  • Fairyily
    Fairyily
    2017-12-27

    亲你这个是scroll-view里面吗

    2017-12-27
    有用
    回复
  • 睡前原谅一切
    睡前原谅一切
    2017-12-27

    在真机上都快。就是开发者工具上卡得要死。要过五六秒才会有效果

    2017-12-27
    有用
    回复
  • 睡前原谅一切
    睡前原谅一切
    2017-12-27

    我是这样写的

    //监听页面滚动高度

      onPageScroll(res) {

        if (res.scrollTop >= 400) {

          this.setData({

            flag: true

          })

        } else {

          this.setData({

            flag: false

          })

        }

      },


    2017-12-27
    有用
    回复
  • Fairyily
    Fairyily
    2017-12-27

    安卓机很卡

    ios 快

    2017-12-27
    有用
    回复
  • 睡前原谅一切
    睡前原谅一切
    2017-12-27

    是在开发者工具上?真机上很快吧

    2017-12-27
    有用
    回复
登录 后发表内容