refactor: 项目重构

This commit is contained in:
郝先瑞
2024-02-07 21:33:51 +08:00
parent cf8a76c203
commit 56f5ac3802
44 changed files with 1005 additions and 1257 deletions

View File

@@ -100,17 +100,24 @@ export const usePermissionStore = defineStore("permission", () => {
}
/**
* 混合模式左侧菜单
* 获取与激活的顶部菜单项相关的混合模式左侧菜单集合
*/
const mixLeftMenu = ref<RouteRecordRaw[]>([]);
function getMixLeftMenu(activeTop: string) {
routes.value.forEach((item) => {
if (item.path === activeTop) {
mixLeftMenu.value = item.children || [];
}
});
const mixLeftMenus = ref<RouteRecordRaw[]>([]);
function setMixLeftMenus(activeTopMenu: string) {
const matchedItem = routes.value.find(
(item) => item.path === activeTopMenu
);
if (matchedItem && matchedItem.children) {
mixLeftMenus.value = matchedItem.children;
}
}
return { routes, setRoutes, generateRoutes, getMixLeftMenu, mixLeftMenu };
return {
routes,
setRoutes,
generateRoutes,
mixLeftMenus,
setMixLeftMenus,
};
});
// 非setup