// 获取容器高度,使页面滚动到容器底部 pageScrollToBottom: function() { wx.createSelectorQuery().select('#j_page').boundingClientRect(function(rect){ // 使页面滚动到底部 wx.pageScrollTo({ scrollTop: rect.bottom }) }).exec() }, j_page为页面容器的id 使用rect.bottom, rect.height均能达到滚动到底部的效果 在数据更新后(setData回调函数)使用 相关api文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/scroll.htmlhttps://mp.weixin.qq.com/debug/wxadoc/dev/api/wxml-nodes-info.html#nodesrefboundingclientrectcallback
j_page
为页面容器的idrect.bottom, rect.height
均能达到滚动到底部的效果相关api文档:
https://mp.weixin.qq.com/debug/wxadoc/dev/api/scroll.html
https://mp.weixin.qq.com/debug/wxadoc/dev/api/wxml-nodes-info.html#nodesrefboundingclientrectcallback