直接上代码
// 滚动条滚动时触发(写在create函数中)
window.onscroll = function() {
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;//据顶部距离
var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;//可视高度
var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;//滚动条总高度
if (scrollTop + windowHeight == scrollHeight) {
//写后台加载数据的函数
}
}