From 6709aeabcf378542a548286482d0536462a7457e Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Sat, 19 Oct 2024 19:22:36 +0800 Subject: [PATCH] fix(web): check readwidth min value --- modules/web/src/views/BookChapter.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/web/src/views/BookChapter.vue b/modules/web/src/views/BookChapter.vue index 34937e293efc..966c6ac3acc8 100644 --- a/modules/web/src/views/BookChapter.vue +++ b/modules/web/src/views/BookChapter.vue @@ -255,9 +255,10 @@ const onResize = () => { const width = store.config.readWidth /**包含padding */ checkPageWidth(width) } -/** 判断阅读宽度是否超出页面 */ +/** 判断阅读宽度是否超出页面或者低于默认值640 */ const checkPageWidth = (readWidth: number) => { if (store.miniInterface) return + if (readWidth < 640) store.config.readWidth = 640 if (readWidth + 2 * 68 > window.innerWidth) store.config.readWidth -= 160 } watch( @@ -462,11 +463,7 @@ const handleKeyPress = (event: KeyboardEvent) => { } // 阻止默认滚动事件 -const ignoreKeyPress = (event: { - key: string - preventDefault: () => void - stopPropagation: () => void -}) => { +const ignoreKeyPress = (event: KeyboardEvent) => { if (event.key === 'ArrowUp' || event.key === 'ArrowDown') { event.preventDefault() event.stopPropagation()