ant-design / pro-components

🏆 Use Ant Design like a Pro!

Home Page:https://pro-components.antdigital.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ferris001 opened this issue · comments

🧐 问题描述

我希望定制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来实现需求?

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