window.onscroll = function(){//变量scrollTop是滚动条滚动时,距离顶部的距离var scrollTop = document.documentElement.scrollTop||document.body.scrollTop;//变量windowHeight是可视区的高度var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;//变量scrollHeight是滚动条的总高度var scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;//滚动条到底部的条件if(scrollTop+windowHeight==scrollHeight){//进行判断var lat=document.getElementById("lat").innerHTML;var lng=document.getElementById("lng").innerHTML;var count=document.getElementById("count").innerHTML;var num= parseInt(count)+1;document.getElementById("count").innerHTML=num;//传参var jsonStr = JSON.stringify({"page":num,"lat":lat,"lng":lng});var token = md5(jsonStr + timestamp)+timestamp; that.$http.post(url+"Index/index",{jsonStr:jsonStr,token:token},{emulateJSON: true}).then((response)=>{response=response.body;var pushList=response.respond;for (let i = 0; i < 10; i++) {that.data.push(pushList[i]);}},(error)=>{alert("数据请求失败");});//到底部判断} }//上拉加载更多
//上拉 加载更多。本打算用betterscroll 可是看不懂,就用scroll判断
<div id="toastC"><img src="./img/loader.gif" alt="" class="loader"></div>
// 在进行渲染时 将loading显示,渲染结束结束渲染,比如在渲染结束函数里放渲染结束事件
//toast同理,显示隐藏罢了