From e91bb9db850e5c14011c62c960ab6d9b61ce7893 Mon Sep 17 00:00:00 2001 From: zhaofang <752743406@qq.com> Date: Wed, 8 Jun 2022 14:21:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E5=8A=A0=E8=BD=BD=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/case/Index.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index 52e1d856..81cbe8d3 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -344,6 +344,17 @@ export default { window.removeEventListener("scroll", this.handleScroll); }, methods: { + debounce(func, wait) {// 非立即执行 + let timeout; + return function () { + let context = this; + let args = arguments; + if (timeout) clearTimeout(timeout); + timeout = setTimeout(() => { + func.apply(context, args) + }, wait); + } + }, //展示全部 displayAll(item) { if (!item.isAll && item.summary && item.summary.length > 190) { @@ -426,8 +437,8 @@ export default { let outerHeight = document.documentElement.clientHeight; let scrollTop = document.documentElement.scrollTop; if (outerHeight + scrollTop + 350 >= innerHeight) { - if (this.moreState == 1 && this.queryCondition.pageIndex < 4) { - this.loadMore(); + if (this.moreState == 1) { + this.debounce(this.loadMore(),5000); } } if (scrollTop > 630) {