有两种方式
一、scroll-into-view
<scroll-view scroll-y scroll-into-view='{{toView}}' style='height: 440px;overflow: auto; '>
<view id="msg-1">1</view> <view id="msg-2">2</view></scroll-view>js中通过setdata来设置toView为最底部view的id值,比如msg-2二、scrolltop
设置
<scroll-view scroll-y :scroll-top="scrollTop" id="scrollview" style="400px;overflow: scroll; '">
<view id="msglistview"><view>1</view> <view>2</view></view></scroll-view>
js来计算scrolltop并setdata
let that = this
let query = uni.createSelectorQuery()
query.select('#scrollview').boundingClientRect()
query.select('#msglistview').boundingClientRect()
query.exec((res) => {
// console.log(res)
if(res[1].height > res[0].height){
that.scrollTop = res[1].height - res[0].height;
console.log( that.scrollTop );
}
})
网友回复
go如何写一个类似redis的nosql数据库让python客户端调用?
php7中为啥无法使用$_SERVER['HTTP_RAW_POST_DATA'] ?
chrome插件能否实现2台电脑的远程协助桌面控制?
python如何通过webrtc网页远程协助控制python运行的电脑?
systemd-nspawn与unshare区别?
Firejail、Bubblewrap沙箱与docker、podman容器区别?
如何访问unshare -n -- python3 -m http.server 8000创建的网站url?
linux中如何限制进程执行非法的系统调用命令,例如reboot 删除等等?
pivot_root与chroot有啥区别?
linux中如何限制进程使用cpu、内存、网络的最大值?


