From f66d2e87641d2769de1a8afb43a8b1f93a13ae8d Mon Sep 17 00:00:00 2001 From: icssoa <615206459@qq.com> Date: Mon, 22 May 2023 20:20:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/upload/components/items/viewer.vue | 2 +- src/modules/upload/components/upload.vue | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/modules/upload/components/items/viewer.vue b/src/modules/upload/components/items/viewer.vue index 81f7853..4de1b4f 100644 --- a/src/modules/upload/components/items/viewer.vue +++ b/src/modules/upload/components/items/viewer.vue @@ -27,7 +27,7 @@ const img = reactive({ }); function open(item: Eps.SpaceInfoEntity, list: Eps.SpaceInfoEntity[]) { - if (item.type) { + if (item?.type) { if (item.type == "image") { img.visible = true; img.urls = list.filter((e) => e.type == "image").map((e) => e.url || ""); diff --git a/src/modules/upload/components/upload.vue b/src/modules/upload/components/upload.vue index dc74061..1361d43 100644 --- a/src/modules/upload/components/upload.vue +++ b/src/modules/upload/components/upload.vue @@ -351,14 +351,7 @@ function clear() { // 预览 function preview(item: Upload.Item) { - if (item.type == "image") { - refs.viewer?.open( - item.preload, - list.value.map((e) => e.preload) - ); - } else { - window.open(item.url); - } + refs.viewer?.open(item, list.value); } // 文件上传请求