productList.vue
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
<div class="bg">
<div class="item" v-if="list.length" v-for="(product,index) in list" @click="goDetail(product)"
:key="index" :class="(index) % 2 === 0 && 'magrin-right'">
<div class="item-top">
<div class="item-price">
<span class="price-flag">{{product.price && '¥'}}</span><span>{{product.price || ' '}}</span>
</div>
<div class="item-sales">{{product.sales && product.sales + '人付款'}}</div>
</div>
<ImgSize class="item-imge" :src="product.default_images" :width="274" :height="274"/>
<div class="item-name">{{product.product_name}}</div>
</div>
</div>
</template>
<script>
import {Scroll} from 'cube-ui';
import ImgSize from '../../../components/img-size';
export default {
props: {
list: Array,
},
methods: {
goDetail(product) {
this.$router.push({
name: 'ProductDetail',
params: {
productId: product.id,
}
});
}
},
components: {
ImgSize,
Scroll,
}
};
</script>
<style lang="scss" scoped>
.magrin-right {
margin-right: 14px;
}
.item {
border-radius: 16px;
width: 344px;
padding: 24px;
height: 498px;
background: #fff;
margin-bottom: 16px;
}
.item-top {
height: 40px;
display: flex;
justify-content: space-between;
margin-bottom: 38px;
align-items: center;
}
.item-price {
color: #d0021b;
font-size: 32px;
vertical-align: center;
}
.item-imge {
width: 274px;
height: 274px;
margin: 0 10px;
}
.item-name {
font-size: 24px;
color: #000;
letter-spacing: 0;
line-height: 40px;
margin-top: 14px;
margin-bottom: 8px;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.item-sales {
font-size: 22px;
color: #999;
}
.price-flag {
font-size: 24px;
}
.bg {
padding: 24px;
display: flex;
flex-wrap: wrap;
}
</style>