mounted() {
var that = this;
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) {
// 加载数据
that.page++;
that.getProduct();
}
};
}