Files
frontend-app/components/shop/ping-item.vue
T
2025-11-10 23:34:16 +08:00

89 lines
1.6 KiB
Vue

<template>
<view class="ping-item" @click.stop="onClick">
<image
class="top-img"
:src="obj.url"
mode="widthFix"
lazy-load
/>
<view class="shop-bottom-panel">
<text class="title text-30 text-zu text-overflow">
{{ obj.title }}
</text>
<view class="flex-r-lr price-line">
<text class="text-28 text-zi text-bold">¥{{ obj.price }}</text>
<text class="text-24 sold">已售{{ obj.sales }}件</text>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'PingItem',
props: {
obj: {
type: Object,
default: () => ({})
}
},
methods: {
onClick() {
this.$emit('ok', this.obj.id);
}
}
};
</script>
<style lang="scss" scoped>
.ping-item {
width: 332rpx;
background: #fff;
border-radius: 12rpx;
overflow: hidden;
margin-bottom: 0; /* 瀑布流父层控制间距,这里清零 */
}
.top-img {
width: 332rpx;
display: block;
border-radius: 12rpx 12rpx 0 0;
}
.shop-bottom-panel {
padding: 12rpx 16rpx 16rpx;
}
.title {
line-height: 40rpx;
max-width: 300rpx;
}
.price-line {
margin-top: 10rpx;
}
.sold {
color: #999;
}
/* 通用工具类(如已全局引入可删除) */
.text-overflow {
display: block;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.text-30 { font-size: 30rpx; }
.text-28 { font-size: 28rpx; }
.text-24 { font-size: 24rpx; }
.text-zu { color: #333; }
.text-zi { color: #7A35F6; }
.text-bold { font-weight: bold; }
.flex-r-lr {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>