refactor: 项目重构
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user