提交 7279c0a7 编写于 作者: V vben

refactor(menu): added 'SimpleMenu' component. Solve the menu stuck problem #199 #190 #191

上级 ff2b12b4
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
- 修复 `TableAction`图标问题 - 修复 `TableAction`图标问题
- 修复菜单折叠按钮丢失问题 - 修复菜单折叠按钮丢失问题
- 修复菜单相关问题
## 2.0.0-rc.16 (2020-01-12) ## 2.0.0-rc.16 (2020-01-12)
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
const { prefixCls } = useDesign('simple-menu'); const { prefixCls } = useDesign('simple-menu');
const getShowMenu = computed(() => { const getShowMenu = computed(() => {
return !props.item.meta?.hideMenu; return !props.item?.hideMenu;
}); });
const getIcon = computed(() => props.item?.icon); const getIcon = computed(() => props.item?.icon);
......
...@@ -45,6 +45,13 @@ export function transformMenuModule(menuModule: MenuModule): Menu { ...@@ -45,6 +45,13 @@ export function transformMenuModule(menuModule: MenuModule): Menu {
export function transformRouteToMenu(routeModList: AppRouteModule[]) { export function transformRouteToMenu(routeModList: AppRouteModule[]) {
const cloneRouteModList = cloneDeep(routeModList); const cloneRouteModList = cloneDeep(routeModList);
const routeList: AppRouteRecordRaw[] = []; const routeList: AppRouteRecordRaw[] = [];
// cloneRouteModList = filter(cloneRouteModList, (node) => {
// if (Reflect.has(node?.meta ?? {}, 'hideMenu')) {
// return !node?.meta.hideMenu;
// }
// return true;
// });
cloneRouteModList.forEach((item) => { cloneRouteModList.forEach((item) => {
if (item.meta?.single) { if (item.meta?.single) {
const realItem = item?.children?.[0]; const realItem = item?.children?.[0];
...@@ -55,13 +62,14 @@ export function transformRouteToMenu(routeModList: AppRouteModule[]) { ...@@ -55,13 +62,14 @@ export function transformRouteToMenu(routeModList: AppRouteModule[]) {
}); });
return treeMap(routeList, { return treeMap(routeList, {
conversion: (node: AppRouteRecordRaw) => { conversion: (node: AppRouteRecordRaw) => {
const { meta: { title, icon } = {} } = node; const { meta: { title, icon, hideMenu = false } = {} } = node;
!isUrl(node.path) && joinParentPath(routeList, node); !isUrl(node.path) && joinParentPath(routeList, node);
return { return {
name: title, name: title,
icon, icon,
path: node.path, path: node.path,
hideMenu,
}; };
}, },
}); });
......
...@@ -75,6 +75,8 @@ export interface Menu { ...@@ -75,6 +75,8 @@ export interface Menu {
meta?: Partial<RouteMeta>; meta?: Partial<RouteMeta>;
tag?: MenuTag; tag?: MenuTag;
hideMenu?: boolean;
} }
export interface MenuModule { export interface MenuModule {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册