请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

请问,5:25这一段代码,写在我的代码中没有效果,怎么回事?

        if (this.listenScroll) {
          let me = this
          //console.log(me) 有效
          this.scroll.on('scroll', (pos) => {
          //console.log(me) 无效
            me.$emit('scroll', pos)
          })
        }

当我滑动页面的时候,无法执行on方法代码块里面的内容

beforeScrollStart、scrollStart 、scrollCance、scrollEnd   偏偏这四个滚动事件就有效,唯独scroll无效, - -!


正在回答

2回答

你的 probeType 传的是多少? 另外,对比一下我的代码,看看哪块不一样的

0 回复 有任何疑惑可以回复我~
  • 提问者 AngryCat #1
    感谢老师回复,明一早我就在仔细的去看看
    回复 有任何疑惑可以回复我~ 2017-06-06 01:25:56
  • 提问者 AngryCat #2
    果然是probeType的传参问题,感谢老师能在百忙中抽出时间为学生解决问题。
    回复 有任何疑惑可以回复我~ 2017-06-06 10:43:50
  • 提问者 AngryCat #3
    非常感谢!
    回复 有任何疑惑可以回复我~ 2017-06-06 10:44:09
我就是那个胖子 2017-06-08 17:37:16

   watch: {

        data() {

          setTimeout(() => {

            this._calculateHeight()

            console.log('111')

          }, 20)

        },

        scrollY(newY) {

          console.log('111')

          const listHeight = this.listHeight

          for (let i = 0; i < listHeight.length; i++) {

            let height1 = listHeight[i]

            let height2 = listHeight[i + 1]

            if (!height2 || (-newY > height1 && -newY < height2)) {

              this.currentIndex = i

              console.log(this.currentIndex)

              return

            }

          }

          this.currentIndex = 0

        }

我也是这一段,打印不出来信息,也没有报错

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号