wxml
js
data: {
height1:'',
scrollHeight: '100vh',
scrollTop: 0, // 内容底部与顶部的距离
},
// 消息滚动到最底部
toViewBottom(){
var query = wx.createSelectorQuery();
var that = this;
query.select("#scrollMsg").boundingClientRect(function(rect){
that.setData({
height1: rect.height + 'px',
})
wx.pageScrollTo({
scrollTop: rect.height,
});
}).exec();
},
toViewBottom()方法要在信息加载完之后的方法里调用,下图就是在图片上传成功之后执行