优化:由于若干问题,暂时隐藏文章阅读数及评论组件

This commit is contained in:
2022-08-01 21:48:32 +08:00
parent 8805396dd3
commit cffeda83ce
11 changed files with 17 additions and 93 deletions

View File

@@ -14,7 +14,7 @@
</span>
<time class="meta-content" :datetime="isoDatetime" :title="toDate">{{ datetime }}</time>
</div>
<div class="meta-item">
<div class="meta-item" v-if="theme.articleMetadataConfig?.showPv ?? false">
<span class="meta-icon pv">
<svg role="img" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><title>阅读数</title><path d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3-7.7 16.2-7.7 35.2 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766z"></path><path d="M508 336c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176z m0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"></path></svg>
</span>
@@ -29,7 +29,6 @@ import { useData } from 'vitepress'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import relativeTime from 'dayjs/plugin/relativeTime'
import md5 from 'blueimp-md5'
// 获取发布时间
const { page, theme, frontmatter } = useData()
@@ -41,13 +40,6 @@ const datetime = date.value.toLocaleString('zh', {year: 'numeric', month: 'numer
dayjs.extend(relativeTime)
dayjs.locale('zh-cn')
const toDate = dayjs().to(dayjs(frontmatter.value.date))
onMounted(() => {
// 记录并获取文章阅读数
$api.getPv(md5(page.value.relativePath), function(data) {
document.getElementById("pv").innerText = data
})
})
</script>
<style scoped>
@@ -66,7 +58,7 @@ onMounted(() => {
font-size: 14px;
}
.meta-item:not(:last-child) {
margin-right: 1.25rem;
margin-right: 1rem;
}
.meta-icon, meta-content {
display: inline-block;