fix: 修复本地上传资源路径解析
This commit is contained in:
@@ -2,6 +2,7 @@ import PhotoSwipe from 'photoswipe';
|
||||
import PhotoSwipeLightbox from 'photoswipe/lightbox';
|
||||
import 'photoswipe/style.css';
|
||||
import { i18n } from '@/locales';
|
||||
import { resolveMediaUrl } from '@/utils/mediaUrl';
|
||||
|
||||
export interface MediaViewerItem {
|
||||
url?: string;
|
||||
@@ -308,7 +309,9 @@ function registerToolbar(lightbox: PhotoSwipeLightbox): void {
|
||||
}
|
||||
|
||||
export async function openMediaViewer(items: MediaViewerItem[], 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);
|
||||
const dataSource = await Promise.all(
|
||||
|
||||
Reference in New Issue
Block a user