This commit is contained in:
kunfei
2023-07-25 21:35:32 +08:00
parent 29a5fe1406
commit 3d5fc133ec
12 changed files with 59 additions and 38 deletions
@@ -59,7 +59,7 @@ const paragraphRef = ref();
const scrollToReadedLength = (length) => {
if (length === 0) return;
let paragraphIndex = chapterPos.value.findIndex(
(wordCount) => wordCount >= length
(wordCount) => wordCount >= length,
);
if (paragraphIndex === -1) return;
nextTick(() => {
@@ -81,14 +81,14 @@ onMounted(() => {
emit(
"readedLengthChange",
props.chapterIndex,
parseInt(target.dataset.chapterpos)
parseInt(target.dataset.chapterpos),
);
}
}
},
{
rootMargin: `0px 0px -${window.innerHeight - 24}px 0px`,
}
},
);
intersectionObserver.observe(titleRef.value);
paragraphRef.value.forEach((element) => {
@@ -105,8 +105,12 @@ onUnmounted(() => {
<style lang="scss" scoped>
.title {
margin-bottom: 57px;
font: 24px / 32px PingFangSC-Regular, HelveticaNeue-Light,
"Helvetica Neue Light", "Microsoft YaHei", sans-serif;
font:
24px / 32px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
}
p {