Committed by
shuaiguo
列表上报获取高度修改,品牌图片修改,列表切换tab参数修改
Showing
3 changed files
with
18 additions
and
4 deletions
@@ -34,6 +34,7 @@ export default { | @@ -34,6 +34,7 @@ export default { | ||
34 | data: function() { | 34 | data: function() { |
35 | return { | 35 | return { |
36 | yasFirstId: 0, | 36 | yasFirstId: 0, |
37 | + itemHeight: 0 | ||
37 | }; | 38 | }; |
38 | }, | 39 | }, |
39 | methods: { | 40 | methods: { |
@@ -59,14 +60,23 @@ export default { | @@ -59,14 +60,23 @@ export default { | ||
59 | }); | 60 | }); |
60 | }, | 61 | }, |
61 | yasShowEvent: function(height) { | 62 | yasShowEvent: function(height) { |
63 | + if (!this.itemHeight) { | ||
64 | + let item = document.querySelector('.product-list-item'); | ||
65 | + | ||
66 | + this.itemHeight = item && item.offsetHeight || 0; | ||
67 | + } | ||
68 | + | ||
69 | + if (!this.itemHeight) { | ||
70 | + return; | ||
71 | + } | ||
72 | + | ||
62 | // 获取列表单个元素高度 | 73 | // 获取列表单个元素高度 |
63 | let index = 0; | 74 | let index = 0; |
64 | 75 | ||
65 | if (Number(height) > 0) { | 76 | if (Number(height) > 0) { |
66 | // 获取第一个曝光元素 | 77 | // 获取第一个曝光元素 |
67 | - let item = document.querySelector('.product-list-item'); | ||
68 | - let itemHeight = item.offsetHeight; | ||
69 | - let row = parseInt((height - 12) / itemHeight) + 1; | 78 | + |
79 | + let row = parseInt((height - 12) / this.itemHeight) + 1; | ||
70 | 80 | ||
71 | index = row * 2 - 2; | 81 | index = row * 2 - 2; |
72 | } | 82 | } |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | :class="filterParams.brand.includes(item.itemId) && 'item-img-selected'" | 11 | :class="filterParams.brand.includes(item.itemId) && 'item-img-selected'" |
12 | v-for="(item,i) in filter.itemList" :style="i===0 && 'margin-left:1rem'" | 12 | v-for="(item,i) in filter.itemList" :style="i===0 && 'margin-left:1rem'" |
13 | @click="select({filterId:filter.filterId, itemId:item.itemId, row})"> | 13 | @click="select({filterId:filter.filterId, itemId:item.itemId, row})"> |
14 | - <ImgSize class="item-img" :src="item.itemUrl" :width="140" :height="70"/> | 14 | + <img class="item-img" :src="(item.itemUrl || '').replace('http://', '//').replace('{width}', 140).replace('{height}', 70)" /> |
15 | <div class="item-img-text">{{item.itemName}}</div> | 15 | <div class="item-img-text">{{item.itemName}}</div> |
16 | </div> | 16 | </div> |
17 | <div class="item-text item-size" v-if="filter.filterId === 'size'" :style="i===0 && 'margin-left:1rem'" | 17 | <div class="item-text item-size" v-if="filter.filterId === 'size'" :style="i===0 && 'margin-left:1rem'" |
@@ -219,6 +219,10 @@ export default { | @@ -219,6 +219,10 @@ export default { | ||
219 | size: filterParams.size.join(','), // 尺码id | 219 | size: filterParams.size.join(','), // 尺码id |
220 | }; | 220 | }; |
221 | 221 | ||
222 | + for (let i in params) { | ||
223 | + !params[i] && delete params[i]; | ||
224 | + } | ||
225 | + | ||
222 | this.selectedType = flag; | 226 | this.selectedType = flag; |
223 | if (flag === 1) { | 227 | if (flag === 1) { |
224 | this.setYasParam({tab: {index: 2, name: '价格'}}); | 228 | this.setYasParam({tab: {index: 2, name: '价格'}}); |
-
Please register or login to post a comment