feat(rewrite): support micro frontend

This commit is contained in:
2026-03-10 14:00:24 +08:00
parent ba33231165
commit bef7bd5f31
6 changed files with 45 additions and 5 deletions

View File

@@ -86,7 +86,8 @@ export default function AppLayout({
e.preventDefault()
if (activeHeaderMenu?.url === item.url) return
let toPathname = menuDefaultRouter[`/${item.url}`] || `/${item.url}`
router.push(toPathname)
window.location.href = toPathname
// router.replace(toPathname)
}}>
<ClientIcon icon={item.icon} style={{ width: "1rem", height: "1rem" }} />
{item.title}

View File

@@ -2,9 +2,9 @@
import { useAppLayoutStore } from "@/components/layout/store"
// import { useLoginStore } from "../login/store"
import { MenuItem } from "./common"
import { usePathname, useSearchParams } from "next/navigation"
import { useEffect, useMemo } from "react"
import { MenuItem } from "./common"
interface ComponentProps {
menu: MenuItem[] | undefined
}
@@ -45,7 +45,9 @@ export function PathnameRecorder({ menu }: ComponentProps) {
`/${sideNavMenu?.url}` !== pathname &&
updateMenuDefaultRouter(
`/${sideNavMenu?.url}`,
queryString ? `${pathname}?${queryString}` : pathname
queryString
? `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}?${queryString}`
: `${process.env.NEXT_PUBLIC_BASE_PATH}${pathname}`
)
}, [queryString, pathname, sideNavMenu?.url, updateMenuDefaultRouter])
return <></>

View File

@@ -96,6 +96,16 @@ export const componentList: MenuItem[] = [
},
],
},
{
title: "图片标注",
url: "image",
icon: "SystemIcon",
},
{
title: "视频标注",
url: "video",
icon: "SystemIcon",
},
]
export const showList: MenuItem[] = []