Skip to content

Commit ef81ed2

Browse files
committed
feat: add busuanzi visitor counter (PV/UV) to navbar
1 parent 7cd206f commit ef81ed2

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</head>
99
<body class="bg-surface text-gray-100 antialiased">
1010
<div id="app"></div>
11+
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
1112
<script type="module" src="/src/main.ts"></script>
1213
</body>
1314
</html>

src/components/NavBar.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ function toggleLocale() { locale.value = locale.value === 'zh' ? 'en' : 'zh' }
6666
</div>
6767

6868
<div class="flex items-center gap-2">
69+
<!-- Visitor counter (busuanzi) -->
70+
<span id="busuanzi_container_site_pv" style="display:none" class="items-center gap-1 text-xs text-gray-500">
71+
<svg class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /></svg>
72+
<span id="busuanzi_value_site_pv" />
73+
</span>
74+
<span id="busuanzi_container_site_uv" style="display:none" class="items-center gap-1 text-xs text-gray-500">
75+
<svg class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" /></svg>
76+
<span id="busuanzi_value_site_uv" />
77+
</span>
78+
6979
<!-- Language switcher -->
7080
<button @click="toggleLocale" class="flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors" title="Switch Language">
7181
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">

0 commit comments

Comments
 (0)