缩放可以实时检测是否横屏

This commit is contained in:
unanmed 2023-06-16 19:17:59 +08:00
parent 1209acce50
commit 754edac71a

View File

@ -16,7 +16,13 @@ const dragFnMap = new Map<DragFn, DragMap>();
/**
*
*/
export const isMobile = matchMedia('(max-width: 600px)').matches;
export let isMobile = matchMedia('(max-width: 600px)').matches;
window.addEventListener('resize', () => {
requestAnimationFrame(() => {
isMobile = matchMedia('(max-width: 600px)').matches;
});
});
/**
*