productList.vue
1.65 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
<template>
<div>
<div class="item" v-if="list.length" v-for="(product,index) in list" @click="goDetail(product)"
:class="((index === 0 || index === 1) ? 'top-line':'') +' '+((index) % 2 === 0 ? 'right-line' :'')"
:key="index">
<div class="item-price">{{product.price ? '¥' + product.price : ' '}}</div>
<ImgSize class="item-imge" :src="product.default_images" :width="300" :height="300"/>
<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>
.top-line {
border-top: 1px #ddd solid;
}
.right-line {
border-right: 1px #ddd solid;
}
.item {
width: 9.37rem;
border-bottom: 1px #ddd solid;
padding: 28px 38px 0 38px;
float: left;
overflow: hidden;
height: 560px;
}
.item-price {
height: 32px;
margin-bottom: 38px;
font-size: 28px;
color: #000;
letter-spacing: 0;
}
.item-imge {
width: 300px;
height: 300px;
}
.item-name {
font-size: 28px;
color: #000;
letter-spacing: 0;
text-align: center;
line-height: 40px;
margin-top: 38px;
margin-bottom: 44px;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
</style>