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> <template>
<div relative group> <div relative group>
<status-attachment :attachment="attachment" w-full /> <StatusAttachment :attachment="attachment" w-full />
<div absolute right-2 top-2> <div absolute right-2 top-2>
<div <div
v-if="removable" v-if="removable"

View file

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