feat: 为页面跳转与路由切换添加埋点上报

This commit is contained in:
ZiuChen
2022-08-19 19:05:07 +08:00
parent c2edf3665c
commit aad60e77c1
2 changed files with 30 additions and 1 deletions

View File

@@ -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() // 执行路由跳转
})
}