From 07d294ac0467b3ee5910890cf400af3080f40d86 Mon Sep 17 00:00:00 2001 From: StanHustler Date: Sat, 23 Sep 2023 21:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dweb=E9=98=85=E8=AF=BB?= =?UTF-8?q?=E7=BF=BB=E9=A1=B5=E5=8A=A8=E7=94=BB=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=97=B6=E5=86=8D=E6=AC=A1=E8=A7=A6=E5=8F=91=E7=BF=BB=E9=A1=B5?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E9=A1=B5=E9=9D=A2=E6=8A=BD=E6=90=90=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/web/src/views/BookChapter.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/web/src/views/BookChapter.vue b/modules/web/src/views/BookChapter.vue index bf4610068..23cf7b632 100644 --- a/modules/web/src/views/BookChapter.vue +++ b/modules/web/src/views/BookChapter.vue @@ -403,8 +403,10 @@ const onReachBottom = (entries) => { } }; +let canJump = true; // 监听方向键 const handleKeyPress = (event) => { + if (!canJump) return; switch (event.key) { case "ArrowLeft": event.stopPropagation(); @@ -425,8 +427,10 @@ const handleKeyPress = (event) => { type: "warn", }); } else { + canJump = false; jump(0 - document.documentElement.clientHeight + 100, { duration: store.config.jumpDuration, + callback: () => (canJump = true), }); } break; @@ -443,8 +447,10 @@ const handleKeyPress = (event) => { type: "warn", }); } else { + canJump = false; jump(document.documentElement.clientHeight - 100, { duration: store.config.jumpDuration, + callback: () => (canJump = true), }); } break;