mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-23 14:40:49 +08:00
13 lines
322 B
JavaScript
13 lines
322 B
JavaScript
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)
|