Переглянути джерело

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

bug: 第一点击目录时没有跳转到合适位置
Xwite 3 роки тому
батько
коміт
4af74a6a61
1 змінених файлів з 35 додано та 0 видалено
  1. 35 0
      modules/web/src/components/CatalogItem.vue

+ 35 - 0
modules/web/src/components/CatalogItem.vue

@@ -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>