mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
修复web阅读上下方向键二段跳的问题
This commit is contained in:
parent
0b828581ca
commit
8349fda250
@ -79,6 +79,7 @@
|
|||||||
"watchEffect": true,
|
"watchEffect": true,
|
||||||
"watchPostEffect": true,
|
"watchPostEffect": true,
|
||||||
"watchSyncEffect": true,
|
"watchSyncEffect": true,
|
||||||
"toValue": true
|
"toValue": true,
|
||||||
|
"WritableComputedRef": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
modules/web/src/auto-imports.d.ts
vendored
3
modules/web/src/auto-imports.d.ts
vendored
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
// noinspection JSUnusedGlobalSymbols
|
||||||
// Generated by unplugin-auto-import
|
// Generated by unplugin-auto-import
|
||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
@ -81,5 +82,5 @@ declare global {
|
|||||||
// for type re-export
|
// for type re-export
|
||||||
declare global {
|
declare global {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
|
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
|
||||||
}
|
}
|
||||||
|
4
modules/web/src/components.d.ts
vendored
4
modules/web/src/components.d.ts
vendored
@ -3,11 +3,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// Generated by unplugin-vue-components
|
// Generated by unplugin-vue-components
|
||||||
// Read more: https://github.com/vuejs/core/pull/3399
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
import '@vue/runtime-core'
|
|
||||||
|
|
||||||
export {}
|
export {}
|
||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
BookItems: typeof import('./components/BookItems.vue')['default']
|
BookItems: typeof import('./components/BookItems.vue')['default']
|
||||||
CatalogItem: typeof import('./components/CatalogItem.vue')['default']
|
CatalogItem: typeof import('./components/CatalogItem.vue')['default']
|
||||||
|
@ -446,6 +446,15 @@ const handleKeyPress = (event) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 阻止默认滚动事件
|
||||||
|
const ignoreKeyPress = (event) => {
|
||||||
|
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
//获取书籍数据
|
//获取书籍数据
|
||||||
let bookUrl = sessionStorage.getItem("bookUrl");
|
let bookUrl = sessionStorage.getItem("bookUrl");
|
||||||
@ -484,6 +493,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
getContent(chapterIndex, true, chapterPos);
|
getContent(chapterIndex, true, chapterPos);
|
||||||
window.addEventListener("keyup", handleKeyPress);
|
window.addEventListener("keyup", handleKeyPress);
|
||||||
|
window.addEventListener("keydown", ignoreKeyPress);
|
||||||
// 兼容Safari < 14
|
// 兼容Safari < 14
|
||||||
document.addEventListener("visibilitychange", onVisibilityChange);
|
document.addEventListener("visibilitychange", onVisibilityChange);
|
||||||
//监听底部加载
|
//监听底部加载
|
||||||
@ -505,6 +515,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener("keyup", handleKeyPress);
|
window.removeEventListener("keyup", handleKeyPress);
|
||||||
|
window.removeEventListener("keydown", ignoreKeyPress);
|
||||||
window.removeEventListener("resize", onResize);
|
window.removeEventListener("resize", onResize);
|
||||||
// 兼容Safari < 14
|
// 兼容Safari < 14
|
||||||
document.removeEventListener("visibilitychange", onVisibilityChange);
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
||||||
|
Loading…
Reference in New Issue
Block a user