product-item.vue
886 Bytes
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
<template>
<div class="product-wrapper">
<img :src="url" alt="" srcset="">
<div class="price">{{price}}</div>
</div>
</template>
<script>
export default {
name: 'ProductItem',
props: {
pid:{
type: String,
default() {
return '1212'
}
},
url: {
type: String,
default() {
return '//tvax2.sinaimg.cn/crop.0.0.828.828.50/006IPkwKly8fyhr791kkxj30n00n0q3u.jpg';
}
},
price: {
type: String,
default() {
return '¥121314';
}
}
}
}
</script>
<style lang="scss" scoped>
.product-wrapper {
display: inline-block;
position: relative;
width: 100px;
height: 100px;
}
.price {
width: 100%;
height: 28px;
line-height: 28px;
font-size: 20px;
position: absolute;
bottom: 0;
text-align: center;
background: rgba(0,0,0,0.50);
color: white;
}
</style>