scrollBottom() {
wx.createSelectorQuery()
.select("#charRoom")
.boundingClientRect(function(rect) {
wx.pageScrollTo({
scrollTop: rect.bottom,
duration:0
});
})
.exec();
}
复制代码
If the page is static, then, on the onReady
life cycle, so the page scrolls in the end portion of the rear ready. If the dynamic data should be performed on the request returns
-
wx.createSelectorQuery the api acquired page - the size of the face, and then
wx.pageScrollTo
scroll to the corresponding position-
.select('#id')
Select the rolling element id -
.boundingClientRect add queries layout position of the nodes. Returns the size and the position coordinates of four corners
-
-
wx.pageScrollTo applet api, scroll position.
Reproduced in: https: //juejin.im/post/5cff56476fb9a07ea33c0c23