Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menus配置:当子路由的hideMenu都为true时,菜单渲染错误 #346

Closed
3 tasks done
ZhongMingKun opened this issue Mar 10, 2021 · 5 comments
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@ZhongMingKun
Copy link

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Make sure the code is up to date. (Some bugs have been fixed in the latest code)
  • This is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.

Describe the bug

菜单渲染错误

Reproduction

router/menus/modules/xxx.ts

import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
  orderNo: 0,
  menu: {
    path: '/merchant',
    name: t('routes.merchant.manage'),
    children: [
      {
        path: 'list',
        name: t('routes.merchant.list'),
        hideMenu: true,
      },
      {
        path: 'add',
        name: t('routes.merchant.add'),
        hideMenu: true,
      },
      {
        path: 'bind_bankcard',
        name: t('routes.merchant.bindBankcard'),
        hideMenu: true,
      },
      {
        path: 'detail',
        name: t('routes.merchant.detail'),
        hideMenu: true,
      },
    ],
  },
};
export default menu;

展示效果有问题:顶部菜单混合模式下不应该出现左侧空白菜单

image

顶部菜单模式不应该有下拉菜单

image

** 左侧菜单模式应该可以直接跳转而不是打开折叠菜单而里面却没内容**

image

左侧菜单混合模式不应该出现空白菜单

image

System Info

  • Operating System: win10
  • Node version: 14.5.0
  • Package manager (npm/yarn/pnpm) and version: yarn 1.22.5
@anncwb
Copy link
Collaborator

anncwb commented Mar 10, 2021

bug之外的问题,你能说说你菜单为什么要都隐藏吗,为什么不直接隐藏父级

@ZhongMingKun
Copy link
Author

ZhongMingKun commented Mar 10, 2021

bug之外的问题,你能说说你菜单为什么要都隐藏吗,为什么不直接隐藏父级

有列表页、详情页、编辑页;都在这个父级菜单下的,默认重定向到列表页,详情页、编辑页通过列表中的操作按钮跳转;不写到同一个父级下,跳转详情页、编辑页的时候菜单的高亮就不在当前父级菜单了

@carl-jin
Copy link

bug之外的问题,你能说说你菜单为什么要都隐藏吗,为什么不直接隐藏父级

我印象中, 见过作者好像发过关于这个项目的一些功能实现原理, 作者有空能共享下吗, 我想补习补习, 学习下设计思路

@anncwb anncwb added the bug Something isn't working label Mar 10, 2021
@ZhongMingKun
Copy link
Author

bug之外的问题,你能说说你菜单为什么要都隐藏吗,为什么不直接隐藏父级

参考ant-design-pro-layout 希望可以添加hideChildrenInMenu之类的属性去控制

@anncwb anncwb closed this as completed in b67cf22 Mar 18, 2021
@visualhu
Copy link
Contributor

子菜单设置hideMenu: true时,访问该菜单父菜单失去高亮功能。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants