refactor(modules/web): Mirgrat to typescript; fix bugs
This commit is contained in:
1 parent
b95deeb607
commit
7984c45cb9
81 files changed
+6396
-3166
No files matched your search
@@ -11,25 +11,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
const props = defineProps([
|
||||
"index",
|
||||
"source",
|
||||
"gotoChapter",
|
||||
"currentChapterIndex",
|
||||
]);
|
||||
<script setup lang="ts">
|
||||
import type { BookChapter } from '@/book'
|
||||
|
||||
const isSelected = (idx) => {
|
||||
return idx == props.currentChapterIndex;
|
||||
};
|
||||
const props = defineProps<{
|
||||
index: number
|
||||
source: BookChapter | { index: number; catas: BookChapter[] }
|
||||
gotoChapter: (chapter: BookChapter) => void
|
||||
currentChapterIndex: number
|
||||
}>()
|
||||
|
||||
const isSelected = (idx: number) => {
|
||||
return idx == props.currentChapterIndex
|
||||
}
|
||||
|
||||
// PC端 一个虚拟列表中有两个章节
|
||||
const catas = computed(() => {
|
||||
return props.source?.catas ?? [props.source];
|
||||
});
|
||||
const source = props.source
|
||||
if ('catas' in source) return source.catas
|
||||
return [props.source as BookChapter]
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped>
|
||||
.selected {
|
||||
color: #eb4259;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user