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);