vuescroll如何实现滚动判断?-创新互联
这篇文章将为大家详细讲解有关vue scroll如何实现滚动判断?,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

1、是否滚动到底部
isScrollBottom() {
// 是否滚动到了底部
this.box = this.$refs.chatListWrapper
var clientHeight = this.box.clientHeight
var scrollTop = this.box.scrollTop
var scrollHeight = this.box.scrollHeight
if (scrollTop + clientHeight == scrollHeight) {
this.$store.dispatch('setBottomBtn', false, { root: true }) // 隐藏直达最新消息按钮
this.isBottom = true
this.isTop = false
} else {
this.$store.dispatch('setBottomBtn', true, { root: true }) // 显示直达最新消息按钮
this.isTop = false
this.isBottom = false
if (scrollTop == 0) {
this.isTop = true
}
}
},另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享名称:vuescroll如何实现滚动判断?-创新互联
标题网址:http://www.jxjierui.cn/article/cdppoh.html


咨询
建站咨询
