vue-waterfall2 瀑布流,触底加载更多
监听滚动到底部事件:
function isScrollToBottom() {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
const clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
return scrollTop + clientHeight >= scrollHeight-100;
}
在mounted里增加监听scroll:
mounted() {
let _this = this
this.dataList = this.originData
window.addEventListener('scroll', function () {
// 判断是否滚动到了底部
if (isScrollToBottom() && !_this.loading) {
_this.loading = true;
// 加载更多内容
_this.loadmore()
}
});
},
这样就可以触底loadmore了。。
参考链接:
vue-waterfall2的简介及使用教程 - Made with Vuejs
实现当滚动到页面底部时,加载更多内容_在最底部的分页 切换时 底部变多-CSDN博客
原文地址:https://blog.csdn.net/zmttpassion/article/details/136340026
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!