fix(theme): fix blog cover layout error in mobile (#611)

This commit is contained in:
pengzhanbo 2025-06-01 21:41:32 +08:00 committed by GitHub
parent d5ea846e8a
commit 3c2a34729e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,8 @@
<script lang="ts" setup>
import type { BlogPostCoverStyle, ThemeBlogPostItem } from '../../../shared/index.js'
import VPLink from '@theme/VPLink.vue'
import { useMediaQuery } from '@vueuse/core'
import { computed } from 'vue'
import { isMobile as _isMobile } from '@vuepress/helper/client'
import { computed, onMounted, ref } from 'vue'
import { withBase } from 'vuepress/client'
import { useData, useInternalLink, useTagColors } from '../../composables/index.js'
@ -11,8 +11,16 @@ const props = defineProps<{
index: number
}>()
const isMobile = ref(false)
onMounted(() => {
isMobile.value = _isMobile(navigator.userAgent)
window.addEventListener('resize', () => {
isMobile.value = _isMobile(navigator.userAgent)
})
})
const { blog } = useData()
const isMobile = useMediaQuery('(max-width: 496px)')
const colors = useTagColors()
const { categories: categoriesLink, tags: tagsLink } = useInternalLink()