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工作流
坐落在白雪覆盖的广阔平原上2只可爱的雪豹
一位宇航员做在一只乌龟上在星空中游走
一个外国人在吹奏萨克斯ComfyUI工作流
一只开屏的白色孔雀ComfyUI工作流
一辆停在混凝土墙前运动型SUV捷豹概念车
一幅梦幻家园comfyui工作流
一个迷人而丰满的女巫和一只黑猫骑着飞天扫帚
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!