collectshop.vue
6.1 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<template>
<view>
<uni-swipe-action>
<uni-swipe-action-item v-for="(item,index) in swipeList" :options="item.options" :key="item.id" @change="swipeChange"
@click="swipeClick($event,index)">
<!-- <text class="cont">{{item.content}}</text> -->
<view class="searchshop commnonpadding">
<view class="searchgooditem flex boxsizing">
<view class="shopleftimg">
<image src="../../static/shop.png" mode=""></image>
</view>
<view class="shopright">
<view class="shopname">湖北省南阳市南阳面粉厂</view>
<view class="shopmiddle flexone">
<view class="shopmiddleleft">
8.2
</view>
<view class="shopmiddleright">
<view class="star flex">
<view class="starimg">
<image src="../../static/shixing.png" mode=""></image>
</view>
<view class="starimg">
<image src="../../static/shixing.png" mode=""></image>
</view>
<view class="starimg">
<image src="../../static/shixing.png" mode=""></image>
</view>
<view class="starimg">
<image src="../../static/shixing.png" mode=""></image>
</view>
<view class="starimg">
<image src="../../static/kongxing.png" mode=""></image>
</view>
</view>
<view class="haoping">好评率96%</view>
</view>
</view>
<view class="shopdizhi flexone">
<view class="shopdiimg">
<image src="../../static/shopaddress.png" mode=""></image>
</view>
<view class='shopli'>距离256km</view>
</view>
</view>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</template>
<script>
import uniSection from '@/components/uni-section/uni-section.vue'
import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue'
import uniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue'
export default {
components: {
uniSection,
uniSwipeAction,
uniSwipeActionItem
},
data() {
return {
swipeList: [{
id: 1,
options: [{
text: '取消收藏',
style: {
backgroundColor: '#DAD7DB'
}
}],
content: 'item2'
}, ]
}
},
onReady() {
this.$nextTick(() => {
this.isOpened = true
})
},
methods: {
bindClick(e) {
uni.showToast({
title: `点击了${e.content.text}按钮`,
icon: 'none'
})
},
setOpened() {
this.isOpened = !this.isOpened
},
change(e) {
this.isOpened = e
console.log('返回:', e);
},
swipeChange(e) {
console.log('返回:', e);
},
swipeClick(e, index) {
console.log(e)
let {
content
} = e
// if (content.text === '删除') {
// uni.showModal({
// title: '提示',
// content: '是否删除',
// success: (res) => {
// if (res.confirm) {
// // console.log('88888')
// this.swipeList.splice(index, 1)
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// });
// } else if (content.text === '添加') {
// if (this.swipeList.length < 10) {
// this.swipeList.push({
// id: new Date().getTime(),
// options: [{
// text: '置顶'
// }, {
// text: '标记为已读',
// style: {
// backgroundColor: 'rgb(254,156,1)'
// }
// }, {
// text: '删除',
// style: {
// backgroundColor: 'rgb(255,58,49)'
// }
// }],
// content: '新增'
// })
// uni.showToast({
// title: `添加了一条数据`,
// icon: 'none'
// })
// } else {
// uni.showToast({
// title: `最多添加十条数据`,
// icon: 'none'
// })
// }
// }
console.log('777889789')
uni.showToast({
title: `点击了${e.content.text}按钮`,
icon: 'none'
})
}
}
}
</script>
<style>
@import url('../../base/homepage');
/* 头条小程序组件内不能引入字体 */
/* #ifdef MP-TOUTIAO */
@font-face {
font-family: uniicons;
font-weight: normal;
font-style: normal;
src: url('~@/static/uni.ttf') format('truetype');
}
/* #endif */
/* #ifndef APP-NVUE */
page {
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #efeff4;
min-height: 100%;
height: auto;
}
view {
font-size: 14px;
line-height: inherit;
}
.example {
padding: 0 15px 15px;
}
.example-info {
padding: 15px;
color: #3b4144;
background: #ffffff;
}
.example-body {
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
padding: 0;
font-size: 14px;
background-color: #ffffff;
}
/* #endif */
.example {
padding: 0 15px;
}
.example-info {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
padding: 15px;
color: #3b4144;
background-color: #ffffff;
font-size: 14px;
line-height: 20px;
}
.example-info-text {
font-size: 14px;
line-height: 20px;
color: #3b4144;
}
.example-body {
flex-direction: column;
padding: 15px;
background-color: #ffffff;
}
.word-btn-white {
font-size: 18px;
color: #FFFFFF;
}
.word-btn {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
border-radius: 6px;
height: 48px;
margin: 15px;
background-color: #007AFF;
}
.word-btn--hover {
background-color: #4ca2ff;
}
.cont {
flex: 1;
height: 45px;
line-height: 45px;
padding: 0 15px;
position: relative;
background-color: #fff;
font-size: 15px;
border-bottom-color: #F5F5F5;
border-bottom-width: 1px;
border-bottom-style: solid;
}
.example-body {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
padding: 10px 0;
background-color: #fff;
}
.button {
border-color: #e5e5e5;
border-style: solid;
border-width: 1px;
padding: 4px 8px;
border-radius: 4px;
}
.button-text {
font-size: 15px;
}
</style>