技能提交

This commit is contained in:
fengxiangdebaozi committed 2026-06-29 16:59:23 +08:00
1 parent 210cb5117f
commit 6851c96a45
38 files changed
+8043 -1903

No files matched your search

+15 -15
View File
@@ -8,21 +8,21 @@ import {
import { RouteBaseContext } from "@/core/route-base";
export function useRouter() {
const navigate = useNavigate();
const base = useContext(RouteBaseContext);
return useMemo(
() => ({
push: (href: string) =>
navigate(href.replace("/page/workspace", base)),
replace: (href: string) =>
navigate(href.replace("/page/workspace", base), { replace: true }),
back: () => navigate(-1),
forward: () => navigate(1),
refresh: () => window.location.reload(),
prefetch: async () => {},
}),
export function useRouter() {
const navigate = useNavigate();
const base = useContext(RouteBaseContext);
const resolveHref = (href: string) =>
href.startsWith(base) ? href : href.replace("/page/workspace", base);
return useMemo(
() => ({
push: (href: string) => navigate(resolveHref(href)),
replace: (href: string) => navigate(resolveHref(href), { replace: true }),
back: () => navigate(-1),
forward: () => navigate(1),
refresh: () => window.location.reload(),
prefetch: async () => {},
}),
[navigate, base],
);
}