5***@qq.com
5***@qq.com
  • 发布:2019-08-27 12:16
  • 更新:2019-08-27 12:16
  • 阅读:832

使用demo的IM-chat 在h5端无法自动滚动到底部

分类:uni-app
scrollToBottom: function () {  
    var that = this;  
    var query = uni.createSelectorQuery();  
    query.selectAll('.m-item').boundingClientRect();  
    query.select('#scrollview').boundingClientRect();  

    query.exec(function (res) {  
               //h5端此处打印res显示res[0]是空数组  
                console.log(res)  
        that.style.mitemHeight = 0;  
        res[0].forEach(function (rect) {  
            console.info(rect.height);  
            that.style.mitemHeight = that.style.mitemHeight + rect.height + 20;  
        });  
        that.scrollTop = 600  
        if (that.style.mitemHeight > that.style.contentViewHeight) {  
            that.scrollTop = that.style.mitemHeight - that.style.contentViewHeight;  
        }  
    });  
}

请问这个怎么处理

2019-08-27 12:16 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复