...
|
...
|
@@ -11,7 +11,10 @@ |
|
|
export default {
|
|
|
name: 'Exposure',
|
|
|
props: {
|
|
|
topClassName: String
|
|
|
topClassName: {
|
|
|
type: String,
|
|
|
default: 'top-filter'
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
...
|
...
|
@@ -43,26 +46,28 @@ |
|
|
created() {
|
|
|
},
|
|
|
mounted() {
|
|
|
const filterRect = document.querySelector(`.${this.topClassName}`).getBoundingClientRect();
|
|
|
let timer = setInterval(() => {
|
|
|
const filterRect = document.querySelector(`.${this.topClassName}`).getBoundingClientRect();
|
|
|
|
|
|
// 可见区域顶部距离视口的上边的距离
|
|
|
this.viewArea.top = filterRect.bottom;
|
|
|
// 可见区域顶部距离视口的上边的距离
|
|
|
this.viewArea.top = filterRect.bottom;
|
|
|
|
|
|
// 可见区域底部距离视口的上边的距离
|
|
|
this.viewArea.bottom = window.screen.height;
|
|
|
// 可见区域底部距离视口的上边的距离
|
|
|
this.viewArea.bottom = window.screen.height;
|
|
|
|
|
|
this.$scrollEl = window;
|
|
|
this.scrollEvent = util.throttle(500, this.checkReport);
|
|
|
if (this.$scrollEl) {
|
|
|
this.$scrollEl.addEventListener('scroll', this.scrollEvent);
|
|
|
this.$scrollEl = window;
|
|
|
this.scrollEvent = util.throttle(500, this.checkReport);
|
|
|
if (this.$scrollEl) {
|
|
|
this.$scrollEl.addEventListener('scroll', this.scrollEvent);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.$children.length) {
|
|
|
clearInterval(timer);
|
|
|
this.checkReport(void 0, true);
|
|
|
}
|
|
|
}, 500);
|
|
|
|
|
|
let timer = setInterval(() => {
|
|
|
if (this.$children.length) {
|
|
|
clearInterval(timer);
|
|
|
this.checkReport(void 0, true);
|
|
|
}
|
|
|
}, 500);
|
|
|
}
|
|
|
setInterval(() => {
|
|
|
_.each(_.filter(this.$children, child => child.$options.name === 'ExposureItem'), child => child.report());
|
|
|
}, 3000);
|
...
|
...
|
|