mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
622 B
31 lines
622 B
2 years ago
|
<script setup lang="ts">
|
||
|
interface Props {
|
||
2 years ago
|
srcs: string[]
|
||
2 years ago
|
alt?: string
|
||
4 months ago
|
objectFit?: string
|
||
2 years ago
|
}
|
||
|
|
||
|
const props = defineProps<Props>()
|
||
|
|
||
|
const index = ref(0)
|
||
|
|
||
|
const onError = () => index.value++
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<LazyNuxtImg
|
||
2 years ago
|
v-if="index < props.srcs.length"
|
||
4 months ago
|
:class="{
|
||
|
'!object-contain': props.objectFit === 'contain',
|
||
|
}"
|
||
|
class="m-auto h-full max-h-full w-auto object-cover nc-attachment-image"
|
||
2 years ago
|
:src="props.srcs[index]"
|
||
4 months ago
|
loading="lazy"
|
||
2 years ago
|
:alt="props?.alt || ''"
|
||
|
placeholder
|
||
|
quality="75"
|
||
2 years ago
|
@error="onError"
|
||
2 years ago
|
/>
|
||
2 years ago
|
<component :is="iconMap.imagePlaceholder" v-else />
|
||
2 years ago
|
</template>
|