Pārlūkot izejas kodu

添加百度统计

sunjh 6 gadi atpakaļ
vecāks
revīzija
329b49d8c4
1 mainītis faili ar 12 papildinājumiem un 0 dzēšanām
  1. 12 0
      src/main.js

+ 12 - 0
src/main.js

@@ -62,7 +62,19 @@ import {
 function getCurrentUserSuccess(res){
 
 }
+var _hmt = _hmt || [];
+(function() {
+  var hm = document.createElement("script");
+  hm.src = "https://hm.baidu.com/hm.js?0e3bd98236bd62558926fc433751d60c";
+  var s = document.getElementsByTagName("script")[0];
+  s.parentNode.insertBefore(hm, s);
+})();
 router.beforeEach((to, from, next) => {
+  if (_hmt) {
+    if (to.path) {
+      _hmt.push(['_trackPageview', '/#' + to.fullPath]);
+    }
+  }
   const urls = getAuthUrls()
   if (storageGet('user') == null) {
     getCurrentUser().then((res) => {