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

点开菜单组里面的隐藏菜单的时候 页面刷新了, 菜单组也没有高亮 #2268

Closed
kalsolio opened this issue Sep 11, 2018 · 7 comments

Comments

@kalsolio
Copy link

问题1 页面不应该刷新的吧
问题2 菜单组应该高亮的吧

      {
        path: '/task/order-detail/:sn',
        name: 'orderdetail',
        component: './Task/OrderDetail',
        hideInMenu:true,
        authority: ['admin'],
      },
@ant-design-bot
Copy link

Translation of this issue:


When the hidden menu in the menu group is clicked, the page is refreshed and the menu group is not highlighted.

Question 1 The page should not be refreshed.
Question 2 The menu group should be highlighted.

{
path: '/task/order-detail/:sn',
name: 'orderdetail',
component: './Task/OrderDetail',
hideInMenu: true,
authority: ['admin'],
},

@chenshuai2144
Copy link
Collaborator

隐藏了怎么点击?

@chenshuai2144
Copy link
Collaborator

#2259

@kalsolio
Copy link
Author

菜单隐藏 是不需要在主菜单展示, 在数据列表上 可以点击 详情 进入
这时候 整个页面就会刷新了, 而且链接所在菜单组没有高亮

@chenshuai2144
Copy link
Collaborator

需要自己实现逻辑了

@hana333
Copy link

hana333 commented Feb 12, 2019

你好,解决了吗?碰到了相同的问题,期待回复~

@Weibozzz
Copy link

我是这样解决的
// app.js

export const layout = ({
  initialState,
}: {
  initialState: { settings?: LayoutSettings };
}): BasicLayoutProps => {
  return {
    subMenuItemRender: (_, dom) => {
      const style = location.pathname.includes(_.path) ? {color: '#1890ff'} : {}
      return (
        <div
          style={style}
          onClick={() => {
            if (_.children.length) {
              history.push(_.children[0].path);
            }
          }}
        >
          {dom}
        </div>
      );
    },
    ...initialState?.settings,
  };
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants