ebike-plus-ui/src/hooks/useDevicesSize.ts

17 lines
604 B
TypeScript
Raw Normal View History

2025-01-15 20:24:13 +08:00
import { computed } from "vue";
import { useWindowSize } from "@vueuse/core";
/**
* 768px
* 768px - 1024px
* 1024px
* @returns PC窗口isPc, isPad, isMobile
*/
export const useDevicesSize = () => {
const { width } = useWindowSize();
const isPc = computed(() => width.value > 1024);
const isPad = computed(() => width.value > 768 && width.value <= 1024);
const isMobile = computed(() => width.value <= 768);
return { isPc, isPad, isMobile };
};