课程列表无数据时,下拉内容有问题,会闪的问题

This commit is contained in:
daihh
2022-10-18 14:44:59 +08:00
parent 07b4bb6cd4
commit 0c9424bae8

View File

@@ -111,7 +111,7 @@
<div class="pagination-div">
<span class="pag-text" @click="loadMore()" v-if="moreState == 1 && courseList.length>=course.pageSize">加载更多</span>
<span class="pag-text-msg" v-else-if="moreState == 2">数据加载中</span>
<span class="notcoures" v-else-if="moreState == 3">
<span class="notcoures" v-else-if="moreState == 3 && courseList.length==0">
<img :src="`${webBaseUrl}/images/nocouresimg.png`" alt="">
<h5>暂无课程请优先学习其它课程吧</h5>
</span>
@@ -465,26 +465,29 @@ export default {
this.searchData();
},
handleScroll() {
if(this.courseList.length>6){
let innerHeight = document.querySelector("#couser-list-content").clientHeight;
let outerHeight = document.documentElement.clientHeight;
let scrollTop = document.documentElement.scrollTop;
let outerWidth = document.querySelector(".xcontent2-minor").clientWidth;
if (outerHeight + scrollTop + 350 >= innerHeight) {
if (this.moreState == 1 && this.course.pageIndex < 4) {
this.loadMore();
let innerHeight = document.querySelector("#couser-list-content").clientHeight;
let outerHeight = document.documentElement.clientHeight;
let scrollTop = document.documentElement.scrollTop;
let outerWidth = document.querySelector(".xcontent2-minor").clientWidth;
if (outerHeight + scrollTop + 350 >= innerHeight) {
if (this.moreState == 1 && this.course.pageIndex < 4) {
this.loadMore();
}
}
//console.log(this.course.pageIndex,'this.course.pageIndex');
//加此判断,是为了没有数据时的闪动问题
//if(this.course.pageIndex >1){
if (scrollTop > 830) {
document.querySelector("#fixd-box").style.cssText =
"position: fixed;top: -914px;width:"+outerWidth+"px";
} else {
document.querySelector("#fixd-box").style.cssText = "position: static";
}
//}
}
//console.log(this.course.pageIndex,'this.course.pageIndex');
//加此判断,是为了没有数据时的闪动问题
//if(this.course.pageIndex >1){
if (scrollTop > 830) {
document.querySelector("#fixd-box").style.cssText =
"position: fixed;top: -914px;width:"+outerWidth+"px";
} else {
document.querySelector("#fixd-box").style.cssText = "position: static";
}
//}
},
toNeedCourse() {