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; content: string;
url: string; url: string;
thumb_url: string; thumb_url: string;
meta: string; meta: string | null;
take_time: string; take_time: string;
width?: number; width?: number;
height?: number; height?: number;
@@ -75,14 +75,14 @@ const fetchPhotos = async () => {
const data = await response.json(); const data = await response.json();
// 处理图片 URL // 处理图片 URL
const nextPhotos = data.data.map((photo: MediaItem) => { 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 { return {
...photo, ...photo,
url: getImageUrl(photo.url), url: getImageUrl(photo.url),
thumb_url: getImageUrl(photo.thumb_url), thumb_url: getImageUrl(photo.thumb_url),
width: parsedMeta.COMPUTED.Width, width: parsedMeta?.COMPUTED.Width,
height: parsedMeta.COMPUTED.Height, height: parsedMeta?.COMPUTED.Height,
}; };
}); });
photos.value = nextPhotos; photos.value = nextPhotos;
+1 -1
View File
@@ -10,7 +10,7 @@ interface MediaItem {
content: string; content: string;
url: string; url: string;
thumb_url: string; thumb_url: string;
meta: string; meta: string | null;
take_time: string; take_time: string;
width?: number; width?: number;
height?: number; height?: number;