feat:更新MySQL博客

This commit is contained in:
2025-12-21 17:17:42 +08:00
parent c2516e04b5
commit 3911a00a51
8 changed files with 695 additions and 55 deletions

View File

@@ -34,12 +34,15 @@ import { useData } from 'vitepress'
const wordCount = ref(0)
const imageCount = ref(0)
// 获取页面数据
const { page } = useData()
// 文字阅读时间
const wordTime = computed(() => {
return ((wordCount.value / 275) * 60)
})
// 图片阅读时间
const imageTime = computed(() => {
const n = imageCount.value
if (imageCount.value <= 10) {
@@ -54,13 +57,14 @@ const readTime = computed(() => {
return Math.ceil((wordTime.value + imageTime.value) / 60)
})
function analyze() {
document.querySelectorAll('.meta-des').forEach(v => v.remove())
const analyze = () => {
// 选择文档内容区域
const docDomContainer = window.document.querySelector('#VPContent')
const imgs = docDomContainer?.querySelectorAll<HTMLImageElement>(
'.content-container .main img'
)
// 统计图片数量
const imgs = docDomContainer?.querySelectorAll<HTMLImageElement>('.content-container .main img')
imageCount.value = imgs?.length || 0
// 统计文字数量textContent提取纯文本
const words = docDomContainer?.querySelector('.content-container .main')?.textContent || ''
wordCount.value = countWord(words)
}