19 lines
534 B
Vue
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>
|