fix: 修复本地上传资源路径解析

This commit is contained in:
Nixevol
2026-07-07 02:23:48 +08:00
parent 98b4b8b079
commit fa98f02458
18 changed files with 186 additions and 48 deletions
@@ -1,6 +1,7 @@
import PhotoSwipe from 'photoswipe';
import PhotoSwipeLightbox from 'photoswipe/lightbox';
import 'photoswipe/style.css';
import { resolveMediaUrl } from '@/utils/mediaUrl';
export interface MediaItem {
url?: string;
@@ -67,7 +68,9 @@ function bindWheelZoom(lightbox: PhotoSwipeLightbox): void {
}
export async function openMediaViewer(items: MediaItem[], index = 0): Promise<void> {
const list = (items || []).filter((item) => item.url);
const list = (items || [])
.map((item) => ({ ...item, url: resolveMediaUrl(item.url) }))
.filter((item) => item.url);
if (!list.length) return;
const start = Math.min(Math.max(index, 0), list.length - 1);