perf: 优化iframe预览,不区分大小写;预览背景不透明

This commit is contained in:
jmal 2024-07-30 14:06:27 +08:00
parent d76a3b2c77
commit 8aab4d1038
2 changed files with 9 additions and 5 deletions

View File

@ -4358,13 +4358,16 @@ export default {
return this.notPreviewDialogVisible; return this.notPreviewDialogVisible;
}, },
hasIframePreview(suffix, fileHandlers) { hasIframePreview(suffix, fileHandlers) {
// 将 suffix 转换为小写
const lowerCaseSuffix = suffix.toLowerCase();
for (let key in fileHandlers) { for (let key in fileHandlers) {
const extensions = key.split(',') // 将 key 中的扩展名全部转换为小写
if (extensions.includes(suffix)) { const extensions = key.split(',').map(extension => extension.toLowerCase());
return fileHandlers[key] if (extensions.includes(lowerCaseSuffix)) {
return fileHandlers[key];
} }
} }
return null return null;
}, },
determineDownload(file) { determineDownload(file) {
this.download(file) this.download(file)

View File

@ -13,7 +13,7 @@
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-button size="medium" type="primary" @click="openUrl"><svg-icon icon-class="wailian"/></el-button> <el-button title="外部打开" size="medium" type="primary" @click="openUrl"><svg-icon icon-class="wailian"/></el-button>
</div> </div>
</div> </div>
</div> </div>
@ -153,6 +153,7 @@ export default {
-webkit-box-pack: center; -webkit-box-pack: center;
-ms-flex-pack: center; -ms-flex-pack: center;
justify-content: center; justify-content: center;
background: #dcdfe6;
iframe { iframe {
width: 100%; width: 100%;
height: 100%; height: 100%;