小程序里如何使页面自动滚动到底部

//页面自动滚动到底部
  pageScrollToBottom:function(){
    wx.createSelectorQuery().select('.intro').boundingClientRect(function(rect){
        console.log(rect);
        wx.pageScrollTo({
            scrollTop: rect.height,
        });
    }).exec()
  },

intro为页面容器的class
使用rect.bottom, rect.height均能达到滚动到底部的效果
在intro的高度变化后使用

猜你喜欢

转载自blog.csdn.net/xiaoma19941027/article/details/107483618