feat(projects): add static plugin
This commit is contained in:
parent
57216cce3b
commit
bfd2c9cf86
@ -59,7 +59,8 @@ export default {
|
|||||||
{src: '~/plugins/element-ui'},
|
{src: '~/plugins/element-ui'},
|
||||||
{src: '~/plugins/vditor', ssr: false},
|
{src: '~/plugins/vditor', ssr: false},
|
||||||
{src: '~/plugins/vue-sse'},
|
{src: '~/plugins/vue-sse'},
|
||||||
{src: '~/plugins/vue-cropper', ssr: false}
|
{src: '~/plugins/vue-cropper', ssr: false},
|
||||||
|
{src: '~/plugins/goatcounter.js', ssr: false}
|
||||||
],
|
],
|
||||||
/*
|
/*
|
||||||
** Nuxt.js dev-modules
|
** Nuxt.js dev-modules
|
||||||
|
15
plugins/goatcounter.js
Normal file
15
plugins/goatcounter.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// plugins/goatcounter.js
|
||||||
|
|
||||||
|
export default ({ app }) => {
|
||||||
|
// 检查 window 是否已经定义,因为插件在服务端渲染时也会执行
|
||||||
|
if (process.client) {
|
||||||
|
// 创建 script 标签
|
||||||
|
let script = document.createElement('script');
|
||||||
|
script.async = true;
|
||||||
|
script.dataset.goatcounter = "https://statis.atduck.com/count";
|
||||||
|
script.src = "//statis.atduck.com/count.js";
|
||||||
|
|
||||||
|
// 将 script 标签插入到页面中
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user