|
|
@@ -779,26 +779,42 @@
|
|
|
},
|
|
|
methods:{
|
|
|
lazy(){
|
|
|
+ let _this=this;
|
|
|
+ let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;//滚动条距离顶部的高度
|
|
|
+ let scrollHeight = $(document).height();//当前页面的总高度
|
|
|
+ let clientHeight=window.innerHeight;//当前可视的页面高度
|
|
|
+ let count = parseFloat(clientHeight) + parseFloat(scrollTop);//浏览器底部位置
|
|
|
+ //console.log("浏览器底部位置",count);
|
|
|
+ //console.log("页面高度",scrollHeight);
|
|
|
+ //console.log("滚动条高度",scrollTop);
|
|
|
+ if (scrollHeight - count < 40) {
|
|
|
+ if (_this.显示记录列.length < _this.inventoryMissions.length) {
|
|
|
+ _this.加载下方数据并置空上方数据()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //console.log(_this.显示记录列.length)
|
|
|
//可视区域高度(浏览器页面的高度)
|
|
|
- let height=window.innerHeight;
|
|
|
+ //let height=window.innerHeight;
|
|
|
//滚动区域高度
|
|
|
- let scrollHeight = document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
- let _this=this;
|
|
|
+ //let scrollHeight = document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
+ //let _this=this;
|
|
|
// 可视区域+滚动条距离顶部位置 = 浏览器窗口底部的位置
|
|
|
- const count = height + scrollHeight;
|
|
|
+ //const count = height + scrollHeight;
|
|
|
//懒加载盒子高度+懒加载盒子距离顶部位置=计算出盒子底部的距离
|
|
|
- const box_bottom = _this.$refs.box.offsetHeight + _this.$refs.box.offsetTop-500;//移动
|
|
|
- const box_bottomPc = _this.$refs.boxPc.offsetHeight + _this.$refs.boxPc.offsetTop;//pc
|
|
|
- if (box_bottom===-500&&count >= box_bottomPc) {//pc端下划加载
|
|
|
- if (_this.显示记录列.length < _this.inventoryMissions.length) {
|
|
|
- _this.加载下方数据并置空上方数据();
|
|
|
- }
|
|
|
- }
|
|
|
- if (box_bottomPc===0&&count >= box_bottom) {//移动端下划加载
|
|
|
- if (_this.显示记录列.length < _this.inventoryMissions.length) {
|
|
|
- _this.加载下方数据并置空上方数据()
|
|
|
- }
|
|
|
- }
|
|
|
+ //const box_bottom = _this.$refs.box.offsetHeight + _this.$refs.box.offsetTop-500;//移动
|
|
|
+ //const box_bottomPc = _this.$refs.boxPc.offsetHeight + _this.$refs.boxPc.offsetTop;//pc
|
|
|
+ //console.log("浏览器底部位置",count);
|
|
|
+ //console.log("隐藏部分",box_bottomPc-count);
|
|
|
+ // if (box_bottom===-500&&count >= box_bottomPc) {//pc端下划加载
|
|
|
+ // if (_this.显示记录列.length < _this.inventoryMissions.length) {
|
|
|
+ // _this.加载下方数据并置空上方数据();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (box_bottomPc===0&&count >= box_bottom) {//移动端下划加载
|
|
|
+ // if (_this.显示记录列.length < _this.inventoryMissions.length) {
|
|
|
+ // _this.加载下方数据并置空上方数据()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
// 窗口高,滚动条位置,页面长度,追加数据长度
|
|
|
// 滚动条位置+窗口高度=当前显示中的页面底部Y
|
|
|
// 页面长度-当前显示中的页面底部Y=(隐藏的高度!!!!+行高)->求出隐藏了多少行
|