index.vue
3.71 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<template>
<div class="hom-pro-list">
<div class="product-swiper">
<swiper class="product-swiper-box" :options="swiperOption">
<swiper-slide class="product-swiper-item" v-for="(item,index) in productData.slice(0, 3)" :key="index" @click="jumpProductDetail(item)">
<div class="product-swiper-img">
<img class="img" :src="item.image">
</div>
<div class="product-swiper-info">
<label class="product-name">{{item.productName}}</label>
<div class="price-warp">
<div class="price">
¥ {{item.price}}
</div>
<div class="original-price">
¥ {{item.originalPrice}}
</div>
</div>
</div>
</swiper-slide>
</swiper>
<div class="pagination new-pagination"></div>
</div>
<button v-show="componentContent.showMore" class="btn-more" @click="jumpLink(componentContent.linkObj)">查看全部 <span class="icon iconfont icon-arrow-right"></span></button>
</div>
</template>
<script>
import {commonMixin} from '../mixin'
export default {
mixins: [commonMixin],
data () {
return {
index: 1,
swiperOption: {
slidesPerView: 3,
spaceBetween: 12,
autoplay: false, // 可选选项,自动滑动
loop: true,
pagination: {
el: '.new-pagination'
}
}
}
}
}
</script>
<style lang="scss" scoped>
.hom-pro-list{
::v-deep .swiper-wrapper{
position: static;
}
/**横向滑动**/
.product-swiper{
width: 100%;
height: 454px;
padding: 90px 34px 0;
background: url("../../../static/images/newProduct/bg-product-card.png") no-repeat center;
position: relative;
&+.btn-more{
margin-top: 20px;
}
.title{
padding: 22px 0px 0 0;
label{
background-image: none;
color: #A56C4C;
font-style: italic;
padding: 0;
}
}
&-box {
padding-bottom: 20px;
}
&-item {
width: 220px;
position: relative;
background-color: #FFFFFF;
}
&-img {
width: 220px;
height: 220px;
position: relative;
&:after{
content: '';
display: block;
width: 54px;
height: 54px;
background: url("../../../static/images/newProduct/flag-new.png") no-repeat;
position: absolute;
top: 0;
left: 0;
}
.img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
&-info {
background-color: #FFFFFF;
padding: 10px;
text-align: center;
.product-name{
font-size: 20px;
color: #333;
display: block;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
margin-bottom: 6px;
line-height: 28px;
}
.price-warp{
display: flex;
justify-content: center;
align-items: baseline;
line-height: 28px;
.price{
color: #C83732;
font-size: 20px;
margin-right: 10px;
}
.original-price{
font-size: 16px;
color: #ccc;
text-decoration: line-through;
}
}
}
}
}
.pagination{
display: flex;
justify-content: center;
width: 100%;
bottom: 0;
::v-deep .swiper-pagination-bullet{
width: 24px;
height: 4px;
background: #FFFFFF;
opacity: 0.5;
border-radius: 2px;
margin: 0 10px;
}
::v-deep .swiper-pagination-bullet-active{
opacity: 1;
}
}
.btn-more {
width: 170px;
height: 54px;
border: 2px solid #C5AA7B;
color: #C5AA7B;
font-size: 24px;
background-color: transparent;
margin: 20px auto 0;
display: block;
}
</style>