Skip to content

Commit

Permalink
fix: 🐛 修复使用含中文的图片 url 时的加载异常
Browse files Browse the repository at this point in the history
  • Loading branch information
hymbz committed Aug 10, 2024
1 parent b87b024 commit 739e008
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Manga/actions/imageLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const handleImgLoaded = (i: number, e: HTMLImageElement) => {
setState((state) => {
const img = state.imgList[i];
// 与图片全载一起使用时会出现 src 不一样的情况,需要跳过
if (!img || e.src !== img.src) return;
if (!img || e.src !== encodeURI(img.src)) return;
if (img.width !== e.naturalWidth || img.height !== e.naturalHeight)
updateImgSize(state, i, e.naturalWidth, e.naturalHeight);
img.loadType = 'loaded';
Expand Down
5 changes: 3 additions & 2 deletions src/components/Manga/actions/memo/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createMemo } from 'solid-js';
import { createRootMemo, createThrottleMemo } from 'helper';

import { store } from '../../store';
Expand Down Expand Up @@ -66,7 +65,9 @@ export const autoPageNum = createThrottleMemo(() =>
store.rootSize.width >= store.rootSize.height ? 2 : 1,
);

export const pageNum = createMemo(() => store.option.pageNum || autoPageNum());
export const pageNum = createRootMemo(
() => store.option.pageNum || autoPageNum(),
);

/** 是否为单页模式 */
export const isOnePageMode = createRootMemo(
Expand Down

0 comments on commit 739e008

Please sign in to comment.