From 82dc09ad355180a1b41c1e6fb9299ba4bd72d876 Mon Sep 17 00:00:00 2001 From: Akirami <66513481+A-kirami@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:23:34 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=9B=BE=E7=89=87=E6=97=B6=E5=8F=AF=E8=83=BD=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=85=B6=E4=BB=96=E5=9B=BE=E7=89=87=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#200)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/chat/ChatMessageElementImage.vue | 2 +- src/views/preview/image.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/chat/ChatMessageElementImage.vue b/src/components/chat/ChatMessageElementImage.vue index 03c8ef90..8942db13 100644 --- a/src/components/chat/ChatMessageElementImage.vue +++ b/src/components/chat/ChatMessageElementImage.vue @@ -11,7 +11,7 @@ async function previewImage(event: Event) { const currentIndex = Array.from(gallery).indexOf(event.target as HTMLImageElement) const urls = Array.from(gallery).map((img) => img.src) const window = await createPreviewWindow('/preview/image', '图像预览', naturalWidth, naturalHeight) - window.listen('preview-window-created', () => { + window.once('preview-window-created', () => { window.emit('set-preview-content', { urls, currentIndex }) }) } diff --git a/src/views/preview/image.vue b/src/views/preview/image.vue index f442fc66..fad90498 100644 --- a/src/views/preview/image.vue +++ b/src/views/preview/image.vue @@ -11,14 +11,14 @@ interface PreviewContent { currentIndex: number } -let previewContent: PreviewContent = $ref({ +let previewContent = $ref({ urls: [], currentIndex: 0, }) const currentImage = $computed(() => previewContent.urls[previewContent.currentIndex]) -currentWindow.listen('set-preview-content', (e) => { +currentWindow.once('set-preview-content', (e) => { previewContent = e.payload })