|
@@ -76,7 +76,13 @@
|
|
|
@mouseenter="onMaterialPreviewEnter(material)"
|
|
@mouseenter="onMaterialPreviewEnter(material)"
|
|
|
@mouseleave="onMaterialPreviewLeave"
|
|
@mouseleave="onMaterialPreviewLeave"
|
|
|
>
|
|
>
|
|
|
- <img :src="resolveMaterialUrl(material.material_url)" :alt="material.id" decoding="async" />
|
|
|
|
|
|
|
+ <img
|
|
|
|
|
+ :src="materialThumbSrc(material)"
|
|
|
|
|
+ :alt="material.id"
|
|
|
|
|
+ loading="lazy"
|
|
|
|
|
+ decoding="async"
|
|
|
|
|
+ fetchpriority="low"
|
|
|
|
|
+ />
|
|
|
<div class="material-overlay">
|
|
<div class="material-overlay">
|
|
|
<el-icon><Plus /></el-icon>
|
|
<el-icon><Plus /></el-icon>
|
|
|
<span>添加</span>
|
|
<span>添加</span>
|
|
@@ -105,7 +111,13 @@
|
|
|
@mouseenter="onMaterialPreviewEnter(material)"
|
|
@mouseenter="onMaterialPreviewEnter(material)"
|
|
|
@mouseleave="onMaterialPreviewLeave"
|
|
@mouseleave="onMaterialPreviewLeave"
|
|
|
>
|
|
>
|
|
|
- <img :src="resolveMaterialUrl(material.material_url)" :alt="material.id" decoding="async" />
|
|
|
|
|
|
|
+ <img
|
|
|
|
|
+ :src="materialThumbSrc(material)"
|
|
|
|
|
+ :alt="material.id"
|
|
|
|
|
+ loading="lazy"
|
|
|
|
|
+ decoding="async"
|
|
|
|
|
+ fetchpriority="low"
|
|
|
|
|
+ />
|
|
|
<div class="material-overlay">
|
|
<div class="material-overlay">
|
|
|
<el-icon><Plus /></el-icon>
|
|
<el-icon><Plus /></el-icon>
|
|
|
<span>添加</span>
|
|
<span>添加</span>
|
|
@@ -141,7 +153,13 @@
|
|
|
@mouseenter="onMaterialPreviewEnter(material)"
|
|
@mouseenter="onMaterialPreviewEnter(material)"
|
|
|
@mouseleave="onMaterialPreviewLeave"
|
|
@mouseleave="onMaterialPreviewLeave"
|
|
|
>
|
|
>
|
|
|
- <img :src="resolveMaterialUrl(material.material_url)" :alt="material.id" decoding="async" />
|
|
|
|
|
|
|
+ <img
|
|
|
|
|
+ :src="materialThumbSrc(material)"
|
|
|
|
|
+ :alt="material.id"
|
|
|
|
|
+ loading="lazy"
|
|
|
|
|
+ decoding="async"
|
|
|
|
|
+ fetchpriority="low"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -193,12 +211,21 @@ const props = defineProps({
|
|
|
scrollChipsLeft: { type: Function, required: true },
|
|
scrollChipsLeft: { type: Function, required: true },
|
|
|
scrollChipsRight: { type: Function, required: true },
|
|
scrollChipsRight: { type: Function, required: true },
|
|
|
resolveMaterialUrl: { type: Function, required: true },
|
|
resolveMaterialUrl: { type: Function, required: true },
|
|
|
|
|
+ /** 网格缩略图 URL(OSS 可走 image/resize);未传则与 resolveMaterialUrl 相同 */
|
|
|
|
|
+ resolveMaterialThumbnailUrl: { type: Function, default: null },
|
|
|
/** (url: string | null) => void 悬停缩略图显示大图预览,移开传 null */
|
|
/** (url: string | null) => void 悬停缩略图显示大图预览,移开传 null */
|
|
|
materialHoverPreview: { type: Function, default: null }
|
|
materialHoverPreview: { type: Function, default: null }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:materialSearch', 'material-page-change'])
|
|
const emit = defineEmits(['update:materialSearch', 'material-page-change'])
|
|
|
|
|
|
|
|
|
|
+const materialThumbSrc = (m) => {
|
|
|
|
|
+ const raw = m?.material_url
|
|
|
|
|
+ return props.resolveMaterialThumbnailUrl
|
|
|
|
|
+ ? props.resolveMaterialThumbnailUrl(raw)
|
|
|
|
|
+ : props.resolveMaterialUrl(raw)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const onMaterialPreviewEnter = (m) => {
|
|
const onMaterialPreviewEnter = (m) => {
|
|
|
props.materialHoverPreview?.(props.resolveMaterialUrl(m?.material_url))
|
|
props.materialHoverPreview?.(props.resolveMaterialUrl(m?.material_url))
|
|
|
}
|
|
}
|