Feat optimize preview (#156)

* pref: change code structure

* feat(information): support gif preview

* feat(information): support video preview
This commit is contained in:
Hayden
2025-03-03 14:50:06 +08:00
committed by GitHub
parent 1975e2056d
commit 7378a7deae
7 changed files with 174 additions and 23 deletions

View File

@@ -24,6 +24,21 @@
></path>
</svg>
</div>
<div
v-else-if="model.previewType === 'video'"
class="h-full w-full p-1 hover:p-0"
>
<video
class="h-full w-full object-cover"
playsinline
autoplay
loop
disablepictureinpicture
preload="none"
>
<source :src="preview" />
</video>
</div>
<div v-else class="h-full w-full p-1 hover:p-0">
<img class="h-full w-full rounded-lg object-cover" :src="preview" />
</div>

View File

@@ -5,7 +5,24 @@
class="relative mx-auto w-full overflow-hidden rounded-lg preview-aspect"
:style="$sm({ width: `${cardWidth}px` })"
>
<ResponseImage :src="preview" :error="noPreviewContent"></ResponseImage>
<div v-if="previewType === 'video'" class="h-full w-full p-1 hover:p-0">
<video
class="h-full w-full object-cover"
playsinline
autoplay
loop
disablepictureinpicture
preload="none"
>
<source :src="preview" />
</video>
</div>
<ResponseImage
v-else
:src="preview"
:error="noPreviewContent"
></ResponseImage>
<Carousel
v-if="defaultContent.length > 1"
@@ -95,6 +112,7 @@ const { cardWidth } = useConfig()
const {
preview,
previewType,
typeOptions,
currentType,
defaultContent,