From 8aab4d1038c6284e2fb560361155ad3a65969a75 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 30 Jul 2024 14:06:27 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96iframe=E9=A2=84?= =?UTF-8?q?=E8=A7=88,=E4=B8=8D=E5=8C=BA=E5=88=86=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=86=99;=E9=A2=84=E8=A7=88=E8=83=8C=E6=99=AF=E4=B8=8D?= =?UTF-8?q?=E9=80=8F=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 11 +++++++---- src/components/preview/IframeContentPreview.vue | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 0e4041bd..229019fd 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -4358,13 +4358,16 @@ export default { return this.notPreviewDialogVisible; }, hasIframePreview(suffix, fileHandlers) { + // 将 suffix 转换为小写 + const lowerCaseSuffix = suffix.toLowerCase(); for (let key in fileHandlers) { - const extensions = key.split(',') - if (extensions.includes(suffix)) { - return fileHandlers[key] + // 将 key 中的扩展名全部转换为小写 + const extensions = key.split(',').map(extension => extension.toLowerCase()); + if (extensions.includes(lowerCaseSuffix)) { + return fileHandlers[key]; } } - return null + return null; }, determineDownload(file) { this.download(file) diff --git a/src/components/preview/IframeContentPreview.vue b/src/components/preview/IframeContentPreview.vue index 65c87956..c9271987 100644 --- a/src/components/preview/IframeContentPreview.vue +++ b/src/components/preview/IframeContentPreview.vue @@ -13,7 +13,7 @@ :value="item.value"> - + @@ -153,6 +153,7 @@ export default { -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; + background: #dcdfe6; iframe { width: 100%; height: 100%;