Feat optimize preview (#156)
* pref: change code structure * feat(information): support gif preview * feat(information): support video preview
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user