chore: 新增关于项目菜单(该菜单从动态路由调整为静态,且不再需要鉴权)

This commit is contained in:
2024-11-23 22:47:59 +08:00
parent b82ca81b79
commit 7fa42975cf
11 changed files with 144 additions and 1 deletions

View File

@@ -44,7 +44,6 @@ const transformComponentView = (component: string) => {
*/
const formatAsyncRoutes = (menus: RouteItem[]) => {
if (!menus.length) return []
menus.sort((a, b) => (a?.sort ?? 0) - (b?.sort ?? 0)) // 排序
const pathMap = new Map()
const routes = mapTree(menus, (item) => {
pathMap.set(item.id, item.path)
@@ -103,7 +102,9 @@ const storeSetup = () => {
// 合并路由
const setRoutes = (data: RouteRecordRaw[]) => {
// 合并路由并排序
routes.value = [...constantRoutes, ...systemRoutes].concat(data)
.sort((a, b) => (a.meta?.sort ?? 0) - (b.meta?.sort ?? 0))
asyncRoutes.value = data
}