|
@@ -15,8 +15,13 @@ export default {
|
|
|
pvCurPageName: this.pvCurPageName,
|
|
|
};
|
|
|
util.trackRequest(param);//发送统一PV埋点
|
|
|
+ window.addEventListener('beforeunload', this.pvCloseHandle);
|
|
|
}
|
|
|
},
|
|
|
+ //页面销毁时,注销监听程序|返回上一页,去往下一页等
|
|
|
+ destroyed(){
|
|
|
+ window.removeEventListener('beforeunload', this.pvCloseHandle);
|
|
|
+ },
|
|
|
// beforeDestroy() {
|
|
|
// console.warn("---beforeDestroy---")
|
|
|
// this.pvCloseHandle()
|
|
@@ -33,6 +38,7 @@ export default {
|
|
|
// 在离开当前路由前执行的方法
|
|
|
// 例如保存表单数据、清理定时器等操作
|
|
|
this.pvCloseHandle();
|
|
|
+ window.removeEventListener('beforeunload', this.pvCloseHandle);//注销监听刷新事件
|
|
|
next();
|
|
|
},
|
|
|
beforeRouteEnter(to, from, next) {
|
|
@@ -49,6 +55,7 @@ export default {
|
|
|
pvCurPageName: this.pvCurPageName,
|
|
|
};
|
|
|
util.trackRequest(param);//发送统一PV埋点
|
|
|
+ window.addEventListener('beforeunload', this.pvCloseHandle);
|
|
|
}
|
|
|
},
|
|
|
methods: {
|