web阅读增加翻页速度的设置项

This commit is contained in:
StanHustler 2023-09-23 21:05:10 +08:00 committed by Strato69
parent 8349fda250
commit c1facb5f72
3 changed files with 34 additions and 2 deletions

View File

@ -138,6 +138,21 @@
>
</div>
</li>
<li class="paragraph-spacing">
<i>翻页速度</i>
<div class="resize">
<div class="resize">
<span class="less" @click="lessJumpDuration">
<em class="iconfont">&#xe625;</em>
</span>
<b></b> <span class="lang">{{ jumpDuration }}</span
><b></b>
<span class="more" @click="moreJumpDuration"
><em class="iconfont">&#xe626;</em></span
>
</div>
</div>
</li>
<li class="infinite-loading">
<i>无限加载</i>
<span
@ -304,6 +319,18 @@ const lessReadWidth = () => {
if (config.value.readWidth > 640) config.value.readWidth -= 160;
saveConfig(config.value);
};
const jumpDuration = computed(() => {
return store.config.jumpDuration;
});
const moreJumpDuration = () => {
store.config.jumpDuration += 100;
saveConfig(config.value);
};
const lessJumpDuration = () => {
if (store.config.jumpDuration === 0) return;
store.config.jumpDuration -= 100;
saveConfig(config.value);
};
const infiniteLoading = computed(() => {
return store.config.infiniteLoading;
});

View File

@ -22,6 +22,7 @@ export const useBookStore = defineStore("book", {
readWidth: 800,
infiniteLoading: false,
customFontName: "",
jumpDuration: 1000,
spacing: {
paragraph: 1,
line: 0.8,

View File

@ -425,7 +425,9 @@ const handleKeyPress = (event) => {
type: "warn",
});
} else {
jump(0 - document.documentElement.clientHeight + 100);
jump(0 - document.documentElement.clientHeight + 100, {
duration: store.config.jumpDuration,
});
}
break;
case "ArrowDown":
@ -441,7 +443,9 @@ const handleKeyPress = (event) => {
type: "warn",
});
} else {
jump(document.documentElement.clientHeight - 100);
jump(document.documentElement.clientHeight - 100, {
duration: store.config.jumpDuration,
});
}
break;
}