|
|
@@ -446,6 +446,15 @@ const handleKeyPress = (event) => {
|
|
|
break;
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+// 阻止默认滚动事件
|
|
|
+const ignoreKeyPress = (event) => {
|
|
|
+ if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
|
+ event.preventDefault();
|
|
|
+ event.stopPropagation();
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
//获取书籍数据
|
|
|
let bookUrl = sessionStorage.getItem("bookUrl");
|
|
|
@@ -484,6 +493,7 @@ onMounted(() => {
|
|
|
|
|
|
getContent(chapterIndex, true, chapterPos);
|
|
|
window.addEventListener("keyup", handleKeyPress);
|
|
|
+ window.addEventListener("keydown", ignoreKeyPress);
|
|
|
// 兼容Safari < 14
|
|
|
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
|
//监听底部加载
|
|
|
@@ -505,6 +515,7 @@ onMounted(() => {
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
window.removeEventListener("keyup", handleKeyPress);
|
|
|
+ window.removeEventListener("keydown", ignoreKeyPress);
|
|
|
window.removeEventListener("resize", onResize);
|
|
|
// 兼容Safari < 14
|
|
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|