1
0

fix: fallback to image for media

This commit is contained in:
Anthony Fu 2022-11-25 22:31:33 +08:00
parent 4f133aabc0
commit 842102cea4
2 changed files with 14 additions and 20 deletions

View File

@ -16,7 +16,7 @@ defineEmits<{
<template>
<div relative group>
<status-attachment :attachment="attachment" w-full />
<StatusAttachment :attachment="attachment" w-full />
<div absolute right-2 top-2>
<div
v-if="removable"

View File

@ -22,20 +22,7 @@ const aspectRatio = computed(() => {
</script>
<template>
<template v-if="attachment.type === 'image' ">
<CommonBlurhash
:blurhash="attachment.blurhash"
class="status-attachment-image"
:src="attachment.url || attachment.previewUrl!"
:alt="attachment.description!"
:style="{
aspectRatio,
}"
border="~ base"
object-cover rounded-lg
/>
</template>
<template v-else-if="attachment.type === 'video'">
<template v-if="attachment.type === 'video'">
<video
:poster="attachment.previewUrl"
controls
@ -67,11 +54,18 @@ const aspectRatio = computed(() => {
<source :src="attachment.url || attachment.previewUrl" type="audio/mp3">
</audio>
</template>
<!-- Image or "unknown" fallback -->
<template v-else>
<div>
TODO:
<pre>{{ attachment }}
</pre>
</div>
<CommonBlurhash
:blurhash="attachment.blurhash"
class="status-attachment-image"
:src="attachment.url || attachment.previewUrl!"
:alt="attachment.description!"
:style="{
aspectRatio,
}"
border="~ base"
object-cover rounded-lg
/>
</template>
</template>