进入页面增加监听事件:
mounted () {
window.addEventListener("scroll", this.handleScroll, true);
},
离开页面销毁监听:true必须加否则不生效
destroyed(){
window.removeEventListener('scroll', this.handleScroll,true);
},
监听事件:
//即将进去指定区域加载对应数据
handleScroll(){
var height = document.documentElement.clientHeight || document.body.clientHeight;//获取屏幕高度
},