mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-03-04 02:50:59 +08:00
feat: 处理nuxt部分样式问题 & 跳转问题
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user