vercount
vercount 服务器响应时间在 100ms 以内,采用全球 CDN 分发,号称有 99.99% 的可用性。直接在页面嵌入一段 JS 代码,用特定的 span 标签显示数字就行,对 Vite 这样的 SPA 应用也有相应的支持方式。
index.html 配置
html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>你的网站</title>
</head>
<body>
<!-- 你的网站根节点 -->
<div id="root"></div>
<!-- 1. 显示统计数据的元素(可以放在任何你想展示的位置) -->
<footer>
总访问量: <span id="vercount_value_site_pv">0</span> 次
</footer>
<!-- 2. Vercount 统计脚本(放在 body 底部,确保元素已加载) -->
<script defer src="https://events.vercount.one/js"></script>
</body>
</html>在需要显示的 YourShow.vue
vue
<template>
<!-- 直接放置显示统计的 span,样式可以随意调整 -->
<span id="vercount_value_site_uv">加载中...</span> 人
</template>
<script setup>
// js code
</script>