web: 修复快捷键设置bug和esc键逻辑; 修复超大章节列表造成的卡顿

bug: 第一点击目录时没有跳转到合适位置
This commit is contained in:
Xwite
2023-05-10 12:41:55 +08:00
parent 7bd45c46fb
commit 23018b702d
5 changed files with 64 additions and 84 deletions
+2 -3
View File
@@ -148,7 +148,6 @@ const {
config,
readingBook,
} = storeToRefs(store);
const chapterPos = computed({
get: () => readingBook.value.chapterPos,
set: (value) => (readingBook.value.chapterPos = value),
@@ -293,9 +292,9 @@ const toChapterPos = (pos) => {
let wordCount = 0;
if (chapter.value.length != 1) return;
for (let element of chapter.value[0].children) {
wordCount += parseInt(element.getAttribute("wordCount")) + 1;//计算换行符
wordCount += parseInt(element.getAttribute("wordCount")) + 1; //计算换行符
if (wordCount - 1 >= pos) {
//最后一段没有换行符
//最后一段没有换行符
jump(element, {
duration: 0,
});