34 lines
488 B
Vue
34 lines
488 B
Vue
|
<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>
|