|
|
<template>
|
|
|
<resource class="no-padding-right product-list-more">
|
|
|
<resource class="no-padding-right product-list-more" ref="resource">
|
|
|
<ul class="resource-tf-goods"
|
|
|
@touchstart="touchStart"
|
|
|
@touchmove="touchMove"
|
...
|
...
|
@@ -23,6 +23,7 @@ |
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import _ from 'lodash';
|
|
|
import Resource from './resource';
|
|
|
|
|
|
export default {
|
...
|
...
|
@@ -34,7 +35,8 @@ export default { |
|
|
moveX: 0,
|
|
|
disX: 0,
|
|
|
moreSlider: '',
|
|
|
moreMove: ''
|
|
|
moreMove: '',
|
|
|
itemVisibleStatus: {}
|
|
|
};
|
|
|
},
|
|
|
props: {
|
...
|
...
|
@@ -133,8 +135,26 @@ export default { |
|
|
|
|
|
// 用于检测楼层内部item的曝光状态, 暴露给父组件调用
|
|
|
checkReqFromParent() {
|
|
|
console.log('out from self check')
|
|
|
// TODO 检测组件内child item曝光、并返回给parent
|
|
|
let rect;
|
|
|
let isVisible;
|
|
|
let visible = [];
|
|
|
let items = this.$el.querySelectorAll('.product-item');
|
|
|
|
|
|
_.each(items, (item, idx) => {
|
|
|
rect = item.getBoundingClientRect();
|
|
|
isVisible = (rect.left > 0 && rect.left < window.screen.width) ||
|
|
|
((rect.left + rect.width) > 0 && (rect.left + rect.width) < window.screen.width);
|
|
|
|
|
|
if (isVisible && !this.itemVisibleStatus[idx]) {
|
|
|
visible.push({
|
|
|
I_INDEX: idx + 1,
|
|
|
PRD_SKN: this.value.data && this.value.data.list[idx].product_skn
|
|
|
});
|
|
|
}
|
|
|
this.itemVisibleStatus[idx] = isVisible;
|
|
|
});
|
|
|
|
|
|
return visible;
|
|
|
}
|
|
|
},
|
|
|
components: {Resource}
|
...
|
...
|
|