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

🧐[问题]如何为ProLayout的左侧菜单区域下,增加自定义的区域内容。 #8483

Open
ferris001 opened this issue Jun 9, 2024 · 3 comments

Comments

@ferris001
Copy link

ferris001 commented Jun 9, 2024

🧐 问题描述

我希望定制ProLayout,把自定义的内容插入到左侧菜单区域的下面区域。
根据ProLayout文档,尝试自定义menuRender来实现。代码片段如下:

export default function Layout() {
  const { clientRoutes } = useAppData();
  const location = useLocation();
  return (
    <ProLayout
      route={clientRoutes[0]}
      location={location}
      title="Umi x Ant Design"
      layout="side"
      menuRender={(menuProps, defaultDom) => (
        <div>
          {defaultDom}
          <div >
              自定义内容
          </div>
        </div>
      )}
    >
      <Outlet />
    </ProLayout>
  );
}

运行结果是在Menu区域下,并没有出现“自定义内容”。如图:
image

我的疑问是,上面的代码有什么问题?应该要如何自定义menuRender来实现需求?

@ferris001
Copy link
Author

ferris001 commented Jun 11, 2024 via email

@fengzehao
Copy link

我知道了,你应该用menuContentRender
menuContentRender={(props, defaultDom) =><div>{defaultDom}<div>自定义内容</div></ div>}
类似上面这样

@ferris001
Copy link
Author

ferris001 commented Jun 12, 2024 via email

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

2 participants