liveh5-nuxt/app/components/x-image/index.vue
xingyy 5d645a8106 refactor(home): 优化首页艺术品列表功能
- 移除了 x-image 组件中的多余属性
- 更新了 ItemList 组件中的 LOT 编号显示逻辑
-将 home 页面中的 v-show 改为 v-if
- 重构了 tangPopup 组件,添加了下拉刷新和上拉加载更多功能
2025-02-06 16:29:17 +08:00

52 lines
807 B
Vue

<script setup>
import { showImagePreview } from 'vant';
const props = defineProps({
src: {
type: String,
default: ''
},
preview: {
type: Boolean,
default: true
},
// 用于控制图片尺寸
sizes: {
type: Array,
default: () => [320, 640, 768, 1024]
},
// 用于控制图片格式
format: {
type: String,
default: 'webp'
},
// 用于控制图片质量
quality: {
type: Number,
default: 80
}
})
const showImage = () => {
if (props.preview) {
showImagePreview([props.src]);
}
}
</script>
<template>
<nuxt-img
loading="lazy"
v-bind="{ ...props, ...$attrs }"
style="object-fit: cover"
@click="showImage"
:src="src"
/>
</template>
<style scoped>
:deep(img) {
width: 100%;
height: 100%;
}
</style>