feat:更新MySQL博客
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user