fenghe-auction/app/components/x-image/index.vue

34 lines
488 B
Vue
Raw Normal View History

2025-04-10 07:47:40 +00:00
<script setup>
import { showImagePreview } from 'vant';
const props = defineProps({
src: {
type: String,
default: ''
},
preview: {
type: Boolean,
default: true
},
})
const showImage = () => {
if (props.preview) {
showImagePreview([props.src]);
}
}
</script>
<template>
<img
loading="lazy"
v-bind="{ ...$props, ...$attrs }"
style="object-fit: cover"
@click="showImage"
:src="src"
/>
</template>
<style scoped>
</style>