From ef911c284e72931db7d1b6ed82265fd3a9da327e Mon Sep 17 00:00:00 2001 From: ZiuChen <457353192@qq.com> Date: Fri, 19 Aug 2022 19:05:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E9=A1=B5=E9=9D=A2=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E4=B8=8E=E8=B7=AF=E7=94=B1=E5=88=87=E6=8D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9F=8B=E7=82=B9=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/config.js | 21 ++++++++++++++++++++- docs/.vuepress/enhanceApp.js | 10 ++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 docs/.vuepress/enhanceApp.js diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 19ac2078..c6ad92cc 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,7 +1,26 @@ module.exports = { title: 'ZiuChen', description: 'Unlimited Progress.', - head: [['link', { rel: 'icon', href: '/logo.png' }]], + head: [ + ['link', { rel: 'icon', href: '/logo.png' }], + [ + 'script', + {}, + /* js */ ` + var _hmt = _hmt || []; + (function() { + var hm1 = document.createElement("script"); + hm1.src = "https://hm.baidu.com/hm.js?08b4ef50a9244e83e5a1bd5822442829"; // gitee + var hm2 = document.createElement("script"); + hm2.src = "https://hm.baidu.com/hm.js?50bac15a1f238d1aa61f104a5fb6f5e0"; // github + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm1, s); + s.parentNode.insertBefore(hm2, s); + })(); + + ` + ] + ], plugins: [ '@vuepress/medium-zoom', '@vuepress/active-header-links', diff --git a/docs/.vuepress/enhanceApp.js b/docs/.vuepress/enhanceApp.js new file mode 100644 index 00000000..083b9e88 --- /dev/null +++ b/docs/.vuepress/enhanceApp.js @@ -0,0 +1,10 @@ +export default ({ router }) => { + router.beforeEach((to, from, next) => { + if (typeof _hmt !== 'undefined') { + if (to.path) { + _hmt.push(['_trackPageview', to.fullPath]) // 添加埋点上报 + } + } + next() // 执行路由跳转 + }) +}