Files
BewlyBewly/src/components/Picture.vue
2024-10-05 01:14:02 +08:00

22 lines
426 B
Vue

<script setup lang="ts">
defineProps<{
src: string
loading: 'lazy' | 'eager'
alt?: string
}>()
</script>
<template>
<picture>
<source :srcset="`${src}.avif`" type="image/avif">
<source :srcset="`${src}.webp`" type="image/webp">
<img
:src="src"
:loading="loading"
:alt="alt"
block w-full h-full object="[inherit]" aspect-inherit
rounded-inherit
>
</picture>
</template>