wx.createSelectorQuery返回的top值有误,不稳定,是根据什么判断的?
发布于 6 年前 作者 yangxiulan 11525 次浏览 来自 问答

this.createSelectorQuery().select("#footer").boundingClientRect((res) => {

          if (!resreturn;

          let top = res.top;

          let height = windowHeight - res.height;

          console.log(res)

          console.log(top)

          console.log(height)

          if (top < height{

            console.log('进来了')

            this.setData({

              fix: true

            })

          }

        }).exec();

1 回复

你好,真机是否有问题?请提供能复现问题的代码片段看下(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部