js实现滚动加载,自动向后台请求分页数据,全部数据请求完毕后,不能再向下滚动,也不再重复请求。
注:后台用json-server模拟数据,数据格式如下
{
"data": [
{
"title": "1"
},
{
"title": "2"
},
{
"title": "3"
},
{
"title": "4"
},
{
"title": "5"
},
{
"title": "6"
},
{
"title": "7"
},
{
"title": "8"
},
{
"title": "9"
},
{
"title": "10"
},
{
"title": "11"
},
{
"title": "12"
}
]
}
前台代码:
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</t