Skip to content

Commit

Permalink
🐛 修复打开图片时可能打开其他图片的问题 (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
A-kirami authored Aug 5, 2024
1 parent d2582b9 commit 82dc09a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/chat/ChatMessageElementImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/preview/image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ interface PreviewContent {
currentIndex: number
}
let previewContent: PreviewContent = $ref<PreviewContent>({
let previewContent = $ref<PreviewContent>({
urls: [],
currentIndex: 0,
})
const currentImage = $computed(() => previewContent.urls[previewContent.currentIndex])
currentWindow.listen<PreviewContent>('set-preview-content', (e) => {
currentWindow.once<PreviewContent>('set-preview-content', (e) => {
previewContent = e.payload
})
Expand Down

0 comments on commit 82dc09a

Please sign in to comment.