From a89c028c1828dcaf650e3f0f8043be7b399e5c6e Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Fri, 12 Jan 2024 12:07:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E9=80=9A=E8=BF=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E8=87=AA=E5=8A=A8=E9=94=81=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/LockScreen/index.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/LockScreen/index.vue b/src/components/LockScreen/index.vue index d9e4761d..ad3336b0 100644 --- a/src/components/LockScreen/index.vue +++ b/src/components/LockScreen/index.vue @@ -70,7 +70,12 @@ onMounted(() => { } }) .finally(() => { - resetTimeout(); + if (timeoutDuration !== 0) { + resetTimeout(); + // 监听用户的操作,重置超时时间 + window.addEventListener('mousemove', resetTimeout); + window.addEventListener('keydown', resetTimeout); + } if (localGet(CACHE_LOCAL_LOCK) && getToken()) { isLocked.value = localGet(CACHE_LOCAL_LOCK) === 'false' ? false : true; } @@ -84,10 +89,6 @@ onUnmounted(() => { } localRemove(CACHE_LOCAL_LOCK); }); - -// 监听用户的操作,重置超时时间 -window.addEventListener('mousemove', resetTimeout); -window.addEventListener('keydown', resetTimeout);