fix: get attachment src url

zio/stable
三咲智子 2022-11-29 13:01:51 +08:00
parent 0ba7002d62
commit 22b4c4aaa5
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
1 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,8 @@ const { attachment } = defineProps<{
attachment: Attachment attachment: Attachment
}>() }>()
const src = $computed(() => attachment.remoteUrl || attachment.url || attachment.previewUrl!)
const rawAspectRatio = computed(() => { const rawAspectRatio = computed(() => {
if (attachment.meta?.original?.aspect) if (attachment.meta?.original?.aspect)
return attachment.meta.original.aspect return attachment.meta.original.aspect
@ -60,14 +62,14 @@ const aspectRatio = computed(() => {
focus:ring="2 primary inset" focus:ring="2 primary inset"
rounded-lg rounded-lg
@click="openImagePreviewDialog({ @click="openImagePreviewDialog({
src: attachment.url || attachment.previewUrl!, src,
alt: attachment.description!, alt: attachment.description!,
})" })"
> >
<CommonBlurhash <CommonBlurhash
:blurhash="attachment.blurhash" :blurhash="attachment.blurhash"
class="status-attachment-image" class="status-attachment-image"
:src="attachment.url || attachment.previewUrl!" :src="src"
:alt="attachment.description!" :alt="attachment.description!"
:style="{ :style="{
aspectRatio, aspectRatio,