Преглед на файлове

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 преди 11 месеца
родител
ревизия
f46695812b
променени са 2 файла, в които са добавени 29 реда и са изтрити 0 реда
  1. 2 0
      src/plugins/index.js
  2. 27 0
      src/plugins/track/index.js

+ 2 - 0
src/plugins/index.js

@@ -8,12 +8,14 @@
 import vuetify from './vuetify'
 
 import { setupI18n } from '@/plugins/vueI18n'
+// import { track } from '@/plugins/track'
 
 // import { setupSnackbar } from './snackbar'
 
 export function registerPlugins (app) {
   app.use(vuetify)
   setupI18n(app)
+  // track(app)
 
   // setupSnackbar(app)
 }

+ 27 - 0
src/plugins/track/index.js

@@ -0,0 +1,27 @@
+import Track from 'sunshine-track'
+
+const options = {
+  projectKey: 'test-project', // 项目的key
+  userId: 'digger', // 用户id
+  report: {
+    url: 'http://example.com/report', // 上报url
+    reportType: 'img' // 上报方式
+  },
+  switchs: { // 上报数据开关
+    xhr: true, // xhr请求
+    fetch: true, // fetch请求
+    error: true, // 报错
+    hashchange: true, // hash变化
+    history: true, // history变化
+    whitescreen: true, // 白屏
+    performance: true // 页面性能
+  },
+}
+
+// Vue
+export const track = async (app) => {
+  app.use(Track, options)
+}
+
+// // React、Angular
+// Track.init(options)