diff --git a/open-isle-cli/src/utils/screen.js b/open-isle-cli/src/utils/screen.js new file mode 100644 index 000000000..2796da6b3 --- /dev/null +++ b/open-isle-cli/src/utils/screen.js @@ -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)