fix(web): check readwidth min value

This commit is contained in:
Xwite
2024-10-19 20:30:05 +08:00
parent c9a7e3aba8
commit 6709aeabcf
+3 -6
View File
@@ -255,9 +255,10 @@ const onResize = () => {
const width = store.config.readWidth /**包含padding */ const width = store.config.readWidth /**包含padding */
checkPageWidth(width) checkPageWidth(width)
} }
/** 判断阅读宽度是否超出页面 */ /** 判断阅读宽度是否超出页面或者低于默认值640 */
const checkPageWidth = (readWidth: number) => { const checkPageWidth = (readWidth: number) => {
if (store.miniInterface) return if (store.miniInterface) return
if (readWidth < 640) store.config.readWidth = 640
if (readWidth + 2 * 68 > window.innerWidth) store.config.readWidth -= 160 if (readWidth + 2 * 68 > window.innerWidth) store.config.readWidth -= 160
} }
watch( watch(
@@ -462,11 +463,7 @@ const handleKeyPress = (event: KeyboardEvent) => {
} }
// 阻止默认滚动事件 // 阻止默认滚动事件
const ignoreKeyPress = (event: { const ignoreKeyPress = (event: KeyboardEvent) => {
key: string
preventDefault: () => void
stopPropagation: () => void
}) => {
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') { if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()