Skip to content

Commit

Permalink
feat: 添加网站访问量统计
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiaa12 committed Jul 6, 2023
1 parent 8f1e587 commit 721199a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export default defineConfig({
lastUpdated: true,
outDir: "../kuangyx",
head: [
// 添加访问量统计
[
"script",
{
async: "true",
src: "//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js",
},
],
// 添加百度统计
[
"script",
Expand Down
1 change: 1 addition & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ declare module '@vue/runtime-core' {
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElIconCamera: typeof import('@element-plus/icons-vue')['Camera']
ElIconCaretBottom: typeof import('@element-plus/icons-vue')['CaretBottom']
Expand Down
4 changes: 4 additions & 0 deletions src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ features:
details: 是个路人。
---

<el-divider content-position="center">
<p>本站总访问量 <span id="busuanzi_value_site_pv"></span> 次,访客数 <span id="busuanzi_value_site_uv"></span> 人次</p>
</el-divider>

<style>
@media (min-width: 960px) {
.home .VPHero.has-image .main {
Expand Down
17 changes: 17 additions & 0 deletions src/layout/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template>
<defaultLayout :class="getCurClass">
<template #doc-footer-before>
<div class="page_pv">
本文总阅读量 <span id="busuanzi_value_page_pv" /> 次
</div>
</template>
<template #doc-after>
<Comment v-if="route.path !== '/'" />
</template>
Expand Down Expand Up @@ -49,14 +54,17 @@ const getCurClass = computed(() => data.frontmatter.value.class)
.home-comment {
padding: 2em;
}
.el-backtop {
z-index: 2001;
}
:deep(.VPNavBar) {
.content {
white-space: nowrap;
}
}
:deep(.VPDoc.has-aside) {
.content-container {
max-width: 850px;
Expand Down Expand Up @@ -84,6 +92,15 @@ const getCurClass = computed(() => data.frontmatter.value.class)
color: var(--vp-c-green);
cursor: pointer;
}
.page_pv {
line-height: 32px;
font-size: 14px;
font-weight: 500;
text-align: right;
font-family: var(--vp-font-family-base);
color: var(--vp-c-text-1);
}
</style>

<style lang="scss">
Expand Down

0 comments on commit 721199a

Please sign in to comment.