91 lines
1.9 KiB
Vue
91 lines
1.9 KiB
Vue
<template>
|
|
<div class="product-detail-small" @click="toDetail">
|
|
<div class="img">
|
|
<el-image class="el-image" :src="product.cover" alt="" />
|
|
</div>
|
|
<div class="panel">
|
|
<div class="top">
|
|
<span class="tag">现货</span>
|
|
<span>{{ product.names }}</span>
|
|
</div>
|
|
<div class="info">
|
|
<div class="price"><span class="unit">¥</span>{{ product.price }}</div>
|
|
<svg-icon name="home-shop-car" color="#0068B7CC" size="24" class="icon-arrow-right" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { Product } from "@/api/types/types";
|
|
import SvgIcon from "@/component/SvgIcon/SvgIcon.vue";
|
|
const props = defineProps<{
|
|
product: Product.ProductInfo;
|
|
}>();
|
|
const router = useRouter();
|
|
const toDetail = () => {
|
|
router.push({ path: `/product/${props.product.id}` });
|
|
};
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.product-detail-small {
|
|
width: 248px;
|
|
height: 286px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
transition: all 0.5s;
|
|
cursor: pointer;
|
|
&:hover {
|
|
transform: translateY(-8px);
|
|
}
|
|
|
|
.img {
|
|
flex: 0 0 196px;
|
|
width: 100%;
|
|
.el-image {
|
|
width: 84%;
|
|
height: 80%;
|
|
}
|
|
}
|
|
|
|
.panel {
|
|
background-color: #f5f5f566;
|
|
flex: 1 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 0 20px;
|
|
|
|
.top {
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 16px;
|
|
.tag {
|
|
text-align: center;
|
|
border-radius: 13px;
|
|
height: 24px;
|
|
line-height: 24px;
|
|
width: 50px;
|
|
font-size: 11px;
|
|
display: inline-block;
|
|
color: var(--el-color-primary);
|
|
background-color: #0068b733;
|
|
margin-right: 20px;
|
|
}
|
|
}
|
|
.info {
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
.price {
|
|
font-size: 24px;
|
|
color: #ed7620;
|
|
.unit {
|
|
font-size: 22px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|