From cdc4f60c71afefb402dedd47f7623b5c80641015 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Wed, 19 Jun 2024 20:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/config.js | 10 +--------- docs/.vuepress/enhanceApp.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 docs/.vuepress/enhanceApp.js diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 10100481..53ee13a5 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,20 +1,12 @@ /* * @Author: yubaolee | ahfu~ <954478625@qq.com> * @Date: 2023-08-12 10:48:24 - * @LastEditTime: 2024-06-19 20:31:55 + * @LastEditTime: 2024-06-19 20:42:17 * @Description: * @ * @Copyright (c) 2023 by yubaolee | ahfu~ , All Rights Reserved. */ -var _hmt = _hmt || []; -(function() { - var hm = document.createElement("script"); - hm.src = "https://hm.baidu.com/hm.js?93a7b9a145222f9b7109d643a0c58f8d"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(hm, s); -})(); - module.exports = { title: 'OpenAuth.Net', description: '最好用的.net权限工作流框架,最好用的.net vue前后分离框架', diff --git a/docs/.vuepress/enhanceApp.js b/docs/.vuepress/enhanceApp.js new file mode 100644 index 00000000..c2a883a8 --- /dev/null +++ b/docs/.vuepress/enhanceApp.js @@ -0,0 +1,28 @@ +/* + * @Author: yubaolee | ahfu~ <954478625@qq.com> + * @Date: 2024-06-19 20:41:42 + * @LastEditTime: 2024-06-19 20:42:39 + * @Description: + * @ + * @Copyright (c) 2024 by yubaolee | ahfu~ , All Rights Reserved. +*/ +// .vuepress/enhanceApp.js +export default ({ router }) => { + if (process.env.NODE_ENV === 'production' && typeof window !== 'undefined') { + // 百度统计代码 + var _hmt = _hmt || [] + ;(function () { + var hm = document.createElement('script') + hm.src = 'https://hm.baidu.com/hm.js?93a7b9a145222f9b7109d643a0c58f8d' + var s = document.getElementsByTagName('script')[0] + s.parentNode.insertBefore(hm, s) + })() + + // 路由切换时触发百度统计 + router.afterEach(function (to) { + if (window._hmt) { + window._hmt.push(['_trackPageview', to.fullPath]) + } + }) + } +}