Skip to content

Commit 407b001

Browse files
author
fanny
committed
add swiper
1 parent 5b8fce3 commit 407b001

File tree

12 files changed

+588
-59
lines changed

12 files changed

+588
-59
lines changed

package-lock.json

Lines changed: 2 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
"axios": "^0.18.0",
1515
"better-scroll": "^1.12.1",
1616
"fastclick": "^1.0.6",
17-
"iscroll": "^5.2.0",
18-
"mint-ui": "^2.2.13",
1917
"showdown": "^1.8.6",
2018
"vue": "^2.5.2",
2119
"vue-awesome-swiper": "^2.6.7",

src/components/common/shoplist.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ export default {
7878
showBackStatus: false, // 显示返回顶部按钮
7979
showLoading: true, // 显示加载动画
8080
touchend: false, // 没有更多数据
81-
imgBaseUrl: imgBaseUrl
81+
imgBaseUrl: imgBaseUrl,
82+
touched: false
8283
}
8384
},
8485
mounted () {
@@ -97,7 +98,7 @@ export default {
9798
},
9899
methods: {
99100
async initData () {
100-
let res = await this.getShopList((this.latitude, this.longitude, this.offset, this.restaurantCategoryId))
101+
let res = await this.getShopList(this.latitude, this.longitude, this.offset, this.restaurantCategoryId)
101102
this.shopListArr = [...res]
102103
if (res.length < 20) {
103104
this.touchend = true
@@ -108,16 +109,16 @@ export default {
108109
this.showBackStatus = callbackStatus
109110
})
110111
},
111-
getShopList (latitude, longitude, offset, restaurantCategoryId = '', restaurantCategoryIds = '', orderBy = '', deliveryMode = '', supportIds = []) {
112+
getShopList (latitude, longitude, offset = 0, restaurantCategoryId = '', restaurantCategoryIds = '', orderBy = '', deliveryMode = '', supportIds = []) {
112113
let supportStr = ''
113114
supportIds.forEach(item => {
114115
if (item.status) {
115116
supportStr += '&support_ids[]=' + item.id
116117
}
117118
})
118-
let query = '?latitude=' + latitude + '&longitude=' + longitude + '&offset=' + offset + '&limit=20' + '&restaurant_category_id=' + restaurantCategoryId + 'restaurant_category_ids[]' + restaurantCategoryIds
119+
let query = '?latitude=' + latitude + '&longitude=' + longitude + '&offset=' + offset + '&limit=20' + '&restaurant_category_id=' + restaurantCategoryId + '&restaurant_category_ids[]' + restaurantCategoryIds
119120
query += '&order_by=' + orderBy + '&delivery_mode[]=' + deliveryMode + supportStr
120-
this.$axios.get(urls.getShopList + query).then((res) => {
121+
this.$axios.get(urls.shopList + query).then((res) => {
121122
return res
122123
})
123124
},
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<div class="swiper-item" :style="style">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
7+
<script>
8+
/* eslint-disable*/
9+
export default {
10+
name: 'vueSwiperSlide',
11+
created: function() {
12+
let me = this;
13+
let width = this.$parent.width;
14+
let height = this.$parent.height;
15+
width && (this.style.width = width + 'px');
16+
height && (this.style.height = height + 'px');
17+
this.$on('sizeResized', function({width, height}) {
18+
width && (me.style.width = width + 'px');
19+
height && (me.style.height = height + 'px');
20+
});
21+
},
22+
data() {
23+
return {
24+
style: {
25+
width: 100 + '%',
26+
height: 'auto'
27+
}
28+
}
29+
},
30+
updated(val,oldval) {
31+
this.$parent.$emit('childUpdate');
32+
}
33+
}
34+
</script>
35+
36+
<style lang="scss">
37+
.swiper {
38+
&-item {
39+
width: 1200px;
40+
box-sizing: border-box;
41+
flex-shrink: 0;
42+
display: flex;
43+
height: 100%;
44+
}
45+
}
46+
</style>

0 commit comments

Comments
 (0)