|
|
@@ -47,7 +47,8 @@
|
|
|
</template>
|
|
|
<script scoped>
|
|
|
import { msgList } from "@/api/allApi";
|
|
|
-import SiderInfo from '@/components/SiderInfo.vue'
|
|
|
+import SiderInfo from '@/components/SiderInfo.vue';
|
|
|
+import { debounce } from '@/utils/index';
|
|
|
export default{
|
|
|
components: {
|
|
|
SiderInfo
|
|
|
@@ -109,7 +110,7 @@ export default{
|
|
|
var scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;
|
|
|
//滚动条到底部的条件
|
|
|
console.log("距顶部---"+scrollTop+"可视区高度---"+windowHeight+"滚动条总高度---"+scrollHeight);
|
|
|
- if(scrollHeight - (scrollTop+windowHeight) < 10){
|
|
|
+ if(scrollHeight - (scrollTop+windowHeight) < 1){
|
|
|
if(this.page > this.pages){
|
|
|
return
|
|
|
}else{
|
|
|
@@ -120,12 +121,12 @@ export default{
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
- window.addEventListener('scroll', this.handleScroll)
|
|
|
+ window.addEventListener('scroll', debounce(this.handleScroll,500));
|
|
|
},
|
|
|
|
|
|
destroyed () {
|
|
|
// 离开该页面需要移除这个监听的事件,不然会报错
|
|
|
- window.removeEventListener('scroll', this.handleScroll)
|
|
|
+ window.removeEventListener('scroll', this.handleScroll);
|
|
|
}
|
|
|
}
|
|
|
</script>
|