diff --git a/pc/.prettierrc b/pc/.prettierrc new file mode 100644 index 00000000..7599eff5 --- /dev/null +++ b/pc/.prettierrc @@ -0,0 +1,11 @@ +{ + "semi": false, + "singleQuote": true, + "printWidth": 80, + "proseWrap": "preserve", + "bracketSameLine": false, + "endOfLine": "auto", + "tabWidth": 4, + "useTabs": false, + "trailingComma": "none" +} diff --git a/pc/app.vue b/pc/app.vue index 5533ae99..8cc15e96 100644 --- a/pc/app.vue +++ b/pc/app.vue @@ -2,6 +2,7 @@ import { ID_INJECTION_KEY, ElConfigProvider } from 'element-plus' import zhCn from 'element-plus/es/locale/lang/zh-cn' import { useAppStore } from './stores/app' + provide(ID_INJECTION_KEY, { prefix: 100, current: 0 @@ -11,7 +12,8 @@ const config = { } const appStore = useAppStore() const { pc_title, pc_ico, pc_keywords, pc_desc } = appStore.getWebsiteConfig -useHead({ +const { clarity_code } = appStore.getSiteStatistics +const headOptions: any = { title: pc_title, meta: [ { name: 'description', content: pc_desc }, @@ -22,8 +24,23 @@ useHead({ rel: 'icon', href: pc_ico } - ] -}) + ], + script: [] +} + +if (clarity_code) { + headOptions.script.push({ + type: 'text/javascript', + innerHTML: ` + (function(c,l,a,r,i,t,y){ + c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; + t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; + y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); + })(window, document, "clarity", "script", "${clarity_code}"); + ` + }) +} +useHead(headOptions)