关于pageScrollTo
发布于 5 年前 作者 chao80 13794 次浏览 来自 问答

每次都是第一次执行,第二次的时候就不执行了

wx.createSelectorQuery().select(id).boundingClientRect(function (rect) {
// 使页面滚动到底部
 if (rect) {
console.log(rect)
let height = 300 + Number(that.isScrollTop)
console.log(height)
wx.pageScrollTo({
scrollTop: height
})
}
}).exec()
1 回复

wx.createSelectorQuery().select(’#id’).boundingClientRect(function(rect){

      // 使页面滚动到底部

    wx.pageScrollTo({

       scrollTop: rect.bottom

    })

}).exec()

这样呢

回到顶部