Fix: 修复 Meta 解析错误问题

This commit is contained in:
2026-07-27 19:06:42 +08:00
parent f38493be2c
commit e998213888
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -11,7 +11,7 @@ interface MediaItem {
content: string;
url: string;
thumb_url: string;
meta: string;
meta: string | null;
take_time: string;
width?: number;
height?: number;
@@ -75,14 +75,14 @@ const fetchPhotos = async () => {
const data = await response.json();
// 处理图片 URL
const nextPhotos = data.data.map((photo: MediaItem) => {
const parsedMeta = JSON.parse(photo.meta);
const parsedMeta: { COMPUTED: { Width: number; Height: number } } | null = photo.meta ? JSON.parse(photo.meta) : null;
return {
...photo,
url: getImageUrl(photo.url),
thumb_url: getImageUrl(photo.thumb_url),
width: parsedMeta.COMPUTED.Width,
height: parsedMeta.COMPUTED.Height,
width: parsedMeta?.COMPUTED.Width,
height: parsedMeta?.COMPUTED.Height,
};
});
photos.value = nextPhotos;
+1 -1
View File
@@ -10,7 +10,7 @@ interface MediaItem {
content: string;
url: string;
thumb_url: string;
meta: string;
meta: string | null;
take_time: string;
width?: number;
height?: number;