Skip to content

Commit f672228

Browse files
committed
feat: add pv/uv
1 parent b77ddc2 commit f672228

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

src/App.vue

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ let scrollRaf: number | null = null;
3636
let pointerRaf: number | null = null;
3737
let sectionObserver: IntersectionObserver | null = null;
3838
39+
function ensureBusuanziScriptLoaded() {
40+
const scriptId = "busuanzi-script";
41+
if (document.getElementById(scriptId)) return;
42+
43+
const script = document.createElement("script");
44+
script.id = scriptId;
45+
script.async = true;
46+
script.src = "https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js";
47+
document.body.appendChild(script);
48+
}
49+
3950
function toggleLanguageSwitcher() {
4051
isLanguageOpen.value = !isLanguageOpen.value;
4152
}
@@ -199,6 +210,7 @@ onMounted(async () => {
199210
200211
setupSectionObserver();
201212
setupMemberCardHoverZIndex();
213+
ensureBusuanziScriptLoaded();
202214
});
203215
204216
watch(
@@ -293,6 +305,46 @@ onUnmounted(() => {
293305
<span>{{ t("footer.copyright", { year: currentYear }) }}</span>
294306
<span class="footer-divider" aria-hidden="true"> · </span>
295307
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer">蜀ICP备2023035054号-3</a>
308+
<span class="busuanzi" aria-label="访问统计">
309+
<span class="busuanzi-row">
310+
<span id="busuanzi_container_site_uv">
311+
<span class="busuanzi-item" aria-label="UV">
312+
<svg class="busuanzi-icon" viewBox="0 0 24 24" fill="none" aria-hidden="true">
313+
<path
314+
d="M16 7c0 2.21-1.79 4-4 4S8 9.21 8 7s1.79-4 4-4 4 1.79 4 4Z"
315+
stroke="currentColor"
316+
stroke-width="1.8"
317+
/>
318+
<path
319+
d="M5 20c0-3.31 3.13-6 7-6s7 2.69 7 6"
320+
stroke="currentColor"
321+
stroke-width="1.8"
322+
stroke-linecap="round"
323+
/>
324+
</svg>
325+
<span id="busuanzi_value_site_uv"></span>
326+
</span>
327+
</span>
328+
<span id="busuanzi_container_site_pv">
329+
<span class="busuanzi-item" aria-label="PV">
330+
<svg class="busuanzi-icon" viewBox="0 0 24 24" fill="none" aria-hidden="true">
331+
<path
332+
d="M2.5 12s3.5-7 9.5-7 9.5 7 9.5 7-3.5 7-9.5 7-9.5-7-9.5-7Z"
333+
stroke="currentColor"
334+
stroke-width="1.8"
335+
stroke-linejoin="round"
336+
/>
337+
<path
338+
d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"
339+
stroke="currentColor"
340+
stroke-width="1.8"
341+
/>
342+
</svg>
343+
<span id="busuanzi_value_site_pv"></span>
344+
</span>
345+
</span>
346+
</span>
347+
</span>
296348
</p>
297349
</div>
298350
</footer>

src/styles/site.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,36 @@
13911391
margin: 0 0.35rem;
13921392
}
13931393

1394+
.busuanzi {
1395+
display: block;
1396+
margin-top: 0.35rem;
1397+
}
1398+
1399+
.busuanzi-row {
1400+
display: inline-flex;
1401+
align-items: center;
1402+
justify-content: center;
1403+
gap: 0.9rem;
1404+
}
1405+
1406+
.busuanzi-item {
1407+
display: inline-flex;
1408+
align-items: center;
1409+
gap: 0.35rem;
1410+
}
1411+
1412+
.busuanzi-icon {
1413+
width: 14px;
1414+
height: 14px;
1415+
opacity: 0.9;
1416+
vertical-align: -2px;
1417+
}
1418+
1419+
#busuanzi_container_site_pv,
1420+
#busuanzi_container_site_uv {
1421+
display: none;
1422+
}
1423+
13941424
@media (max-width: 768px) {
13951425
.intro-stats {
13961426
grid-template-columns: 1fr;

0 commit comments

Comments
 (0)