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

bug: 第一点击目录时没有跳转到合适位置
This commit is contained in:
Xwite 2023-05-10 12:43:36 +08:00
parent ec9c2fec08
commit 9447bef57b

View File

@ -0,0 +1,35 @@
<template>
<div
class="cata-text"
:class="{ selected: isSelected(source.index) }"
@click="gotoChapter(source)"
>
{{ source.title }}
</div>
</template>
<script setup>
defineProps(["index", "source", "gotoChapter"]);
const store = useBookStore();
const { catalog } = storeToRefs(store);
const index = computed(() => store.readingBook.index);
const isSelected = (idx) => {
return idx == index.value;
};
</script>
<style lang="scss" scoped>
.selected {
color: #eb4259;
}
.cata-text {
margin-right: 26px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>