fix: fallback to file icon when thumbnail load fails
This commit is contained in:
@@ -1693,9 +1693,10 @@
|
||||
<div v-for="file in files" :key="file.name" class="file-grid-item" @click="handleFileClick(file)" @contextmenu.prevent.stop="showFileContextMenu(file, $event)" @touchstart="handleLongPressStart(file, $event)" @touchmove="handleLongPressMove($event)" @touchend="handleLongPressEnd" @touchcancel="handleLongPressEnd" @selectstart.prevent @dragstart.prevent>
|
||||
<div class="file-icon">
|
||||
<!-- 图片缩略图 -->
|
||||
<img v-if="file.name.match(/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i) && getThumbnailUrl(file)"
|
||||
<img v-if="file.name.match(/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i) && getThumbnailUrl(file) && !isThumbnailLoadFailed(file)"
|
||||
:src="getThumbnailUrl(file)"
|
||||
:alt="file.name"
|
||||
@error="markThumbnailLoadFailed(file)"
|
||||
class="file-thumbnail">
|
||||
<!-- 视频图标(不预加载,避免慢) -->
|
||||
<div v-else-if="file.name.match(/\.(mp4|avi|mov|wmv|flv|mkv|webm)$/i)"
|
||||
@@ -1742,9 +1743,10 @@
|
||||
<td class="file-list-name-cell">
|
||||
<div class="file-list-name-wrap">
|
||||
<!-- 图片缩略图 -->
|
||||
<img v-if="file.name.match(/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i) && getThumbnailUrl(file)"
|
||||
<img v-if="file.name.match(/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i) && getThumbnailUrl(file) && !isThumbnailLoadFailed(file)"
|
||||
:src="getThumbnailUrl(file)"
|
||||
:alt="file.name"
|
||||
@error="markThumbnailLoadFailed(file)"
|
||||
class="file-list-thumb">
|
||||
<!-- 视频图标 -->
|
||||
<div v-else-if="file.name.match(/\.(mp4|avi|mov|wmv|flv|mkv|webm)$/i)"
|
||||
|
||||
Reference in New Issue
Block a user