html52.com
我爱小程序-开发者交流社区

createIntersectionObserver真机relativeToViewport无效?

    this._observer = this.createIntersectionObserver({

      thresholds: [1],

      observeAll: true

    })

    this._observer

      .relativeToViewport() //relativeTo真机可以触发,但是relativeToViewport真机不行

      .observe('.item', (res,x) => {

        console.log(res,x);//微信开发者工具中可触发,真机无法触发

        const {active}= res.dataset

        this.setData({

          active

        })

      })

在微信开发工具中relativeTo和relativeToViewport都可以正常触发,单在手机中relativeToViewport 无法触发

手机是红米 k30 pro 微信版本:Version 8.0.6

代码片段 https://developers.weixin.qq.com/s/2N1EMzmg7WrR

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付