[代码优化](v2.6):加入百度统计

This commit is contained in:
zhengjie
2021-02-03 17:12:59 +08:00
parent 732b6ed1db
commit fa12a2ec18
2 changed files with 19 additions and 1 deletions

View File

@@ -5,7 +5,16 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link href="<%= BASE_URL %>favicon.ico" rel="icon">
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?90f1bda302c625462ddc43ce252b821b";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
</head> </head>
<body> <body>

View File

@@ -12,6 +12,15 @@ NProgress.configure({ showSpinner: false })// NProgress Configuration
const whiteList = ['/login']// no redirect whitelist const whiteList = ['/login']// no redirect whitelist
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
setTimeout(() => {
var _hmt = _hmt || [];
(function() {
var hm = document.createElement('script')
hm.src = 'https://hm.baidu.com/hm.js?90f1bda302c625462ddc43ce252b821b'
var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(hm, s)
})()
}, 0)
if (to.meta.title) { if (to.meta.title) {
document.title = to.meta.title + ' - ' + Config.title document.title = to.meta.title + ' - ' + Config.title
} }