Skip to content

Commit

Permalink
fix: 🐛 修复简易阅读模式下的异常滚动
Browse files Browse the repository at this point in the history
  • Loading branch information
hymbz committed Aug 13, 2024
1 parent 0968d72 commit 4aeb54d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"stylelint-order": "^6.0.4",
"stylelint-prettier": "^5.0.2",
"svgo": "^3.3.2",
"sync-fetch": "^0.5.2",
"tslib": "^2.6.3",
"typescript": "^5.5.4",
"vite": "^5.4.0",
Expand Down
44 changes: 44 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/site/other/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
throttle,
createEffectOn,
} from 'helper';
import { renderImgList, store } from 'components/Manga';
import { renderImgList } from 'components/Manga';
import { useInit, toast } from 'main';

import { getEleSelector, isEleSelector } from './eleSelector';
Expand Down Expand Up @@ -242,7 +242,7 @@ import { needTrigged, triggerLazyLoad } from './triggerLazyLoad';
createEffectOn(
renderImgList,
throttle((list) => {
if (list.size === 0 || !store.show) return;
if (list.size === 0 || !mangaProps.show) return;
const lastImgIndex = [...list].at(-1);
if (lastImgIndex === undefined) return;
imgEleList[lastImgIndex]?.scrollIntoView({
Expand All @@ -256,7 +256,7 @@ import { needTrigged, triggerLazyLoad } from './triggerLazyLoad';
// 在退出阅读模式时跳回之前的滚动位置
let laseScroll = window.scrollY;
createEffectOn(
() => store.show,
() => mangaProps.show,
(show) => {
if (show) laseScroll = window.scrollY;
// 稍微延迟一下,等之前触发懒加载时的滚动结束
Expand Down

0 comments on commit 4aeb54d

Please sign in to comment.