feat(projects): add static plugin

This commit is contained in:
ronger 2024-08-12 16:32:25 +08:00
parent 57216cce3b
commit bfd2c9cf86
2 changed files with 17 additions and 1 deletions

View File

@ -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
View 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);
}
};