在main.js中加入
router.beforeEach((to, from, next) => {
if (document.getElementById('script1')) {
document.body.removeChild(document.getElementById('script1'))
}
if (document.getElementById('script2')) {
document.body.removeChild(document.getElementById('script2'))
}
const script1 = document.createElement('script')
script1.id = `script1`
script1.src = `http://s19.cnzz.com/stat.php?id=xxx&web_id=xxx`
script1.language = 'JavaScript'
document.body.appendChild(script1)
const script2 = document.createElement('script')
script2.id = `script2`
script2.src = `http://c.cnzz.com/core.php?web_id=xxx&t=z`
script2.language = 'text/javascript'
script2.charset = 'utf-8'
document.body.appendChild(script2)
next()
})