Skip to content

Commit

Permalink
Merge pull request #246 from jamebal/search
Browse files Browse the repository at this point in the history
perf: 优化iframe预览,不区分大小写;预览背景不透明
  • Loading branch information
jamebal authored Jul 30, 2024
2 parents 20dbf09 + 8aab4d1 commit 5dbe8c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/components/ShowFile/ShowFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/components/preview/IframeContentPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:value="item.value">
</el-option>
</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>
Expand Down Expand Up @@ -153,6 +153,7 @@ export default {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
background: #dcdfe6;
iframe {
width: 100%;
height: 100%;
Expand Down

0 comments on commit 5dbe8c6

Please sign in to comment.