umi项目antd pro ProLayout添加base或开启hash时菜单不能正常选中的解决方法

umi 项目使用 Ant Design Pro ProLayout 组件在添加 base 或开启 hash 时菜单不能正常选中。

解决方法:

传入 location 即可:

  1. const IndexPage: React.FC<BasicLayoutProps> = (props) => {
  2.   const { location, children } = props;
  3.   ...
  4.  
  5.   return (
  6.   <ProLayout
  7.     location={location}
  8.     ...
  9.   >
  10.       {children}
  11.     </ProLayout>
  12.   );
  13. };
  14. export default IndexPage;


未经允许不得转载:前端资源网 - w3h5 » umi项目antd pro ProLayout添加base或开启hash时菜单不能正常选中的解决方法

赞 (1)
分享到: +

评论 板凳

Avatar

换个身份

  • 昵称 (必填)
  • 邮箱 (选填)
  1. #1
    DS
    试一下新评论。
    DS 3年前 (2021-11-07)回复 取消评论