scroll-view 滑动到底部
打算想做一个聊天程序,增加了消息后, 怎么用程序控制scroll-view滑动到最底部?
打算想做一个聊天程序,增加了消息后, 怎么用程序控制scroll-view滑动到最底部?
<scroll-view class=“scrool-view” style=“height: {{ winHeight }}px” scroll-y=“true” scroll-with-animation=“true” scroll-into-view=“{{ scrolltop }}” enable-back-to-top=“true”>
</scroll-view>
winHeight :
wx.getSystemInfo({ success(res) { that.setData({ winHeight: res.windowHeight - 150, }); }, }); |
scrolltop
let ch = { 'text': word, 'time': new Date().getTime(), 'orientation': orientation }; chatListData.push(ch); wx.setStorageSync('chatList', chatListData); var charlenght = chatListData.length; that.setData({ chatList: chatListData, scrolltop: "roll" + charlenght }); |
@sincere 试试把!