fix: 修复本地上传资源路径解析
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user