exposure-item.vue
1.79 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
<template>
<div class="exposure-item">
<slot></slot>
</div>
</template>
<script>
import _ from 'lodash';
import yoho from 'yoho';
import util from 'common/util';
export default {
name: 'ExposureItem',
props: {
pageName: {
type: String
},
pageParams: {
type: String
},
index: {
type: [String, Number]
},
productSkn: {
type: [String, Number]
}
},
data() {
return {
visible: false,
waitingReport: [],
isVisible: false
};
},
methods: {
record(visible) {
// 元素由不可见变为可见则记录,否则不记录
if (!this.isVisiable && visible) {
const param = {
P_NAME: this.pageName, // 页面名称
P_PARAM: this.pageParams, // 页面参数
I_INDEX: this.index, // 内部item的序号
PRD_SKN: this.productSkn // 商品SKN (可选)
};
console.log('push')
this.waitingReport.push(param);
}
this.isVisiable = visible;
},
report() {
if (this.waitingReport.length) {
console.log('>>>>>>>>>report<<<<<<<<<', this.waitingReport)
this.$yas.event('YB_SHOW_EVENT', this.waitingReport);
this.reset();
}
},
reset() {
this.waitingReport = [];
}
}
};
</script>
<style>
</style>