diff --git a/package.json b/package.json index a5f81cc..f82b190 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "v-track", - "version": "0.8.3", + "version": "0.8.5", "description": "一个基于Vue指令的埋点插件", "author": "LHammer ", "scripts": { diff --git a/src/index.js b/src/index.js index ab96172..39c21f0 100644 --- a/src/index.js +++ b/src/index.js @@ -2,20 +2,18 @@ * @Author: 宋慧武 * @Date: 2019-03-06 17:49:29 * @Last Modified by: 宋慧武 - * @Last Modified time: 2019-07-30 21:46:22 + * @Last Modified time: 2019-07-31 10:56:51 */ import * as hooks from "./hooks"; export default class VTrack { constructor() { this.installed = false; - this.curPage = null; // 保存当前页name } // 保存当前点击的元素 static target = null; // Vue.use 将执行此方法 static install(Vue, { trackEvents, trackEnable = {} }) { - const self = this; trackEnable = { UVPV: false, TONP: false, @@ -57,16 +55,10 @@ export default class VTrack { window.onbeforeunload = () => TRACK_TONP(this, this.PAGE_ENTER_TIME); }, // 统计UV、PV - beforeRouteEnter(to, _, next) { - // 防止有些情况该守卫执行多次导致重复埋点的问题 - if (to.fullPath === self.curPage) { - next(); - } else { - self.curPage = to.fullPath; - next(vm => { - trackEnable.UVPV && trackEvents.UVPV(vm); - }); - } + beforeRouteEnter(_, __, next) { + next(vm => { + trackEnable.UVPV && trackEvents.UVPV(vm); + }); }, beforeRouteUpdate(_, __, next) { if (trackEnable.UVPV && trackEnable.UVPV === "routeUpdate") {