怎么实现一进入页面滚动条处于页面底部?
发布于 4 年前 作者 caojun 3424 次浏览 来自 问答

小程序里面做了一个聊天室,想一进入页面,滚动条处于页面底部,显示最新的聊天信息,试了好多种方法,没有实现,求大佬指导!

4 回复

你们用wx.pageScrollTo不会感觉上下闪动吗

使用scroll-view 的scroll-into-view属于可以尝试一下

暴力一点

wx.pageScrollTo({
    scrollTop:99999999999
});

^_^

scrollToBottom() {

let self = this

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

wx.pageScrollTo({

scrollTop: rect.height + 100,

duration: 100

})

}).exec()

},

回到顶部