feat: 处理nuxt部分样式问题 & 跳转问题

This commit is contained in:
Tim
2025-08-08 11:24:52 +08:00
parent 2b1958a603
commit 44daa255c8
8 changed files with 107 additions and 108 deletions

View File

@@ -1,12 +1,14 @@
import { ref, computed } from 'vue'
const width = ref(0)
const isClient = ref(false)
if (process.client) {
if (typeof window !== 'undefined') {
isClient.value = true
width.value = window.innerWidth
window.addEventListener('resize', () => {
width.value = window.innerWidth
})
}
export const isMobile = computed(() => width.value <= 768)
export const isMobile = computed(() => isClient.value && width.value <= 768)