Add global isMobile computed util

This commit is contained in:
Tim
2025-07-17 15:51:28 +08:00
parent 362376c84d
commit f855d08ff0

View File

@@ -0,0 +1,12 @@
import { ref, computed } from 'vue'
// reactive width value to watch window resize events
const width = ref(window.innerWidth)
// update width on resize
window.addEventListener('resize', () => {
width.value = window.innerWidth
})
// global computed property
export const isMobile = computed(() => width.value <= 768)