gemercheung 2 年之前
父节点
当前提交
eeac4550c2
共有 3 个文件被更改,包括 8 次插入5 次删除
  1. 7 3
      packages/core/src/history.ts
  2. 0 1
      packages/core/src/node.ts
  3. 1 1
      play/src/App.vue

+ 7 - 3
packages/core/src/history.ts

@@ -45,9 +45,13 @@ export class IHistory {
         }
         const mediciRegisterIds = (window as any).mediciRegisterIds;
         if (!Array.from(mediciRegisterIds).includes(this._appId) && this._appId) {
-            global.document.addEventListener('readystatechange', this.handleReadystatechange.bind(this), true);
-            global.history.pushState = hook(global.history, 'pushState', this.handlePushState.bind(this));
-            global.history.replaceState = hook(global.history, 'replaceState', this.handlePushState.bind(this));
+            // console.log('注册pageView');
+            if (!this._sdk._stopTrack) {
+                global.document.addEventListener('readystatechange', this.handleReadystatechange.bind(this), true);
+                global.history.pushState = hook(global.history, 'pushState', this.handlePushState.bind(this));
+                global.history.replaceState = hook(global.history, 'replaceState', this.handlePushState.bind(this));
+            }
+
             (window as any).mediciRegisterIds.push(this._appId);
         }
 

+ 0 - 1
packages/core/src/node.ts

@@ -1 +0,0 @@
-// import { EventReturnType, IBaseAction, ICustomAction } from '@medici/types';

+ 1 - 1
play/src/App.vue

@@ -8,7 +8,7 @@ const medici = Medici.init({
     platform: 'web',
     appId: '7b5958d5-1ae6-4ad5-8a87-5fc8a4b92999',
     endPoint: '/track_api', //服务器
-    stopTrack: false,
+    stopTrack: true,
     config: {
         num: 'xkxkxkxk',
     },