您现在的位置:首页 >> 前端 >> 内容

vue单页面之友盟代码统计

时间:2017/8/15 8:54:00 点击:

  核心提示:vue单页面之友盟代码统计在入口App.vue中添加代码templaterouter-view/router-view/templatescriptexport default {name: app,...

vue单页面之友盟代码统计

在入口App.vue中添加代码

<template>  
  <router-view></router-view>  
</template>  
  
<script>  
export default {  
  name: 'app',  
  mounted () {  
    const script = document.createElement('script')  
    script.src = 'https://s95.cnzz.com/z_stat.php?id=1111111111&web_id=1111111111'  
    script.language = 'JavaScript'  
    document.body.appendChild(script)  
  },  
  watch: {  
    '$route' () {  
      if (window._czc) {  
        let location = window.location  
        let contentUrl = location.pathname + location.hash  
        let refererUrl = '/'  
        window._czc.push(['_trackPageview', contentUrl, refererUrl])  
      }  
    }  
  }  
}  
</script>  
vue单页面之友盟代码统计

Tags:VU UE E单 单页 
作者:网络 来源:亱語的博客