2025-01-22 07:44:50 +00:00
|
|
|
<script setup>
|
|
|
|
import { showImagePreview } from 'vant';
|
|
|
|
const props = defineProps({
|
|
|
|
src: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
preview: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
2025-01-23 05:56:18 +00:00
|
|
|
},
|
2025-02-14 08:47:56 +00:00
|
|
|
|
2025-01-22 07:44:50 +00:00
|
|
|
})
|
2025-01-23 05:56:18 +00:00
|
|
|
|
2025-01-22 07:44:50 +00:00
|
|
|
const showImage = () => {
|
|
|
|
if (props.preview) {
|
|
|
|
showImagePreview([props.src]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2025-01-23 05:56:18 +00:00
|
|
|
|
2025-01-22 07:44:50 +00:00
|
|
|
<template>
|
2025-01-23 08:34:34 +00:00
|
|
|
|
2025-02-14 08:47:56 +00:00
|
|
|
<img
|
2025-01-22 08:23:48 +00:00
|
|
|
loading="lazy"
|
2025-02-14 08:47:56 +00:00
|
|
|
v-bind="{ ...$props, ...$attrs }"
|
2025-01-22 08:33:53 +00:00
|
|
|
style="object-fit: cover"
|
2025-01-22 07:44:50 +00:00
|
|
|
@click="showImage"
|
2025-01-23 05:56:18 +00:00
|
|
|
:src="src"
|
|
|
|
/>
|
2025-01-22 07:44:50 +00:00
|
|
|
</template>
|
2025-01-23 05:56:18 +00:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
</style>
|