1、先创建2个参数,pageNum当前页码,totalCount总页面
data(){ return:{ pageNum: 1, totalCount: 0 } }
2、在created()创建一个滚动scroll监听
// 监听滚动条 window.addEventListener("scroll", () => { //滚动条滚动时,距离顶部的距离 let scrollTop = document.documentElement.scrollTop || document.body.scrollTop; //windowHeight是可视区的高度 let windowHeight = document.documentElement.clientHeight || document.body.clientHeight; //scrollHeight是滚动条的总高度 let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; //判断是否到底了 if (scrollTop + windowHeight > scrollHeight - 50) { //根据当前页码和总页面的判断是否再执行接口 if (this.pageNum < this.totalCount) { this.pageNum += 1; this.getPageData(); } } });
上面是“vuejs移动端实现滚动到底部自动分页”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1484.html
workflows工作流
一群邪恶的小黄人ComfyUI工作流
小鸟在黑暗的天空中优雅地跳舞
一条精致透明的朱红色水晶龙
爱因斯坦在做实验3d动漫ComfyUI工作流
一个以破旧的怀旧史努比玩偶
一群蜜蜂和一个六边形蜂巢ComfyUI工作流
半透明的玻璃苹果ComfyUI工作流
一位穿着长袍的强大法师ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!