Files
DysonNetwork/DysonNetwork.Sphere/Client/src/components/AttachmentItem.vue
2025-08-03 21:37:18 +08:00

19 lines
534 B
Vue

<template>
<n-image v-if="itemType == 'image'" :src="remoteSource" class="rounded-md">
<template #error>
<img src="/image-broken.jpg" class="w-32 h-32 rounded-md" />
</template>
</n-image>
</template>
<script lang="ts" setup>
import { NImage } from 'naive-ui'
import { computed } from 'vue'
const props = defineProps<{ item: any }>()
const itemType = computed(() => props.item.mime_type.split('/')[0] ?? 'unknown')
const remoteSource = computed(() => `/cgi/drive/files/${props.item.id}?original=true`)
</script>