vue elementui中使表的滚动条 滚到顶部或底部

复制代码
1.设置table的ref为tableList
 
2.设置滚动至顶部
 
this.$refs.tableList.bodyWrapper.scrollTop =0;
 
3.设置滚动至底部
 
this.$refs.tableList.bodyWrapper.scrollTop =this.$refs.tableList.bodyWrapper.scrollHeight;
 
//如果请求完更新数据,需要使用$nextTick
this.$nextTick(() => {
    this.$refs.tableList.bodyWrapper.scrollTop=this.$refs.tableList.bodyWrapper.scrollHeight;
})
复制代码

 

参考文章:(19条消息) element ui table scrollTop 滚动到行头或行尾_elementui 表格行头行尾_yusirxiaer的博客-CSDN博客

posted on   Mikasa-Ackerman  阅读(864)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示