From f3f3b022d2fbba0806c324eaedbff01cfc8c0e64 Mon Sep 17 00:00:00 2001 From: zhangsir Date: Sun, 28 Apr 2024 09:54:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E6=8F=90=E4=BA=A4=E8=BF=9E?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/study/exam.vue | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pages/study/exam.vue b/pages/study/exam.vue index 1ff3b74..ccc0eaa 100644 --- a/pages/study/exam.vue +++ b/pages/study/exam.vue @@ -31,7 +31,7 @@ - + @@ -230,9 +230,9 @@ } } }, - confirmStop(){ - this.submitTest(); - }, + // confirmStop(){ + // this.submitTest() + // }, cancelStop(){ //应该返回课程面页 this.confirmFinish(); @@ -350,6 +350,16 @@ } }) }, + debounce(func, delay) { + let timerId; + return function (...args) { + if (timerId) clearTimeout(timerId); + timerId = setTimeout(() => { + func.apply(this, args); + timerId = null; + }, delay); + }; + }, present(){ let $this=this; let score=this.countTest(); @@ -386,7 +396,11 @@ } - } + }, + created() { + this.debouncedPresent = this.debounce(this.present, 500); + this.confirmStop = this.debounce(this.submitTest,500) + }, }