功能:更新消息中心和 YumiNail 模块

This commit is contained in:
xiaowang
2026-05-13 12:43:01 +08:00
parent 6b9eba5aca
commit 2074addc40
284 changed files with 21031 additions and 4533 deletions
@@ -0,0 +1,52 @@
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
export const ADMIN_MOBILE_BREAKPOINT = 960
const viewportWidth = ref(
typeof window !== 'undefined' ? window.innerWidth : ADMIN_MOBILE_BREAKPOINT + 1
)
let listenerCount = 0
const updateViewportWidth = () => {
if (typeof window === 'undefined') {
return
}
viewportWidth.value = window.innerWidth
}
const bindViewportListener = () => {
if (typeof window === 'undefined') {
return
}
if (listenerCount === 0) {
window.addEventListener('resize', updateViewportWidth, { passive: true })
}
listenerCount += 1
}
const unbindViewportListener = () => {
if (typeof window === 'undefined') {
return
}
listenerCount = Math.max(0, listenerCount - 1)
if (listenerCount === 0) {
window.removeEventListener('resize', updateViewportWidth)
}
}
export const useAdminViewport = () => {
onMounted(() => {
updateViewportWidth()
bindViewportListener()
})
onBeforeUnmount(() => {
unbindViewportListener()
})
return {
viewportWidth: computed(() => viewportWidth.value),
isMobile: computed(() => viewportWidth.value <= ADMIN_MOBILE_BREAKPOINT)
}
}