feat:初始化业务目录

This commit is contained in:
2026-05-09 10:36:20 +08:00
parent 881506655d
commit 56951c0383
60 changed files with 6955 additions and 184 deletions

22
src/hooks/use-mobile.ts Normal file
View File

@@ -0,0 +1,22 @@
import * as React from "react";
const MOBILE_BREAKPOINT = 768;
const QUERY = `(max-width: ${MOBILE_BREAKPOINT - 1}px)`;
export function useIsMobile(): boolean {
return React.useSyncExternalStore(
(subscribe) => {
if (typeof window === "undefined") {
return () => {};
}
const mql = window.matchMedia(QUERY);
const onChange = () => subscribe();
mql.addEventListener("change", onChange);
return () => mql.removeEventListener("change", onChange);
},
() =>
typeof window !== "undefined" ? window.matchMedia(QUERY).matches : false,
() => false,
);
}