@ant-design/pro-layout 移动模式下点击条目以后自动关闭菜单 | ATLASSC.NET
Skip to main content
/// .DATA.FRAGMENT_20191118

@ant-design/pro-layout 移动模式下点击条目以后自动关闭菜单

1 minAuthor: Z.SHINCHVEN

在Ant Design Pro工程中修改src/layouts/BasicLayout.jsx中的menuItemRender这个prop即可实现在移动模式下点击条目以后自动关闭菜单

// src/layouts/BasicLayout.jsx
const BasicLayout = props => {
  return (
    <ProLayout
      menuItemRender={(menuItemProps, defaultDom) => {
        if (menuItemProps.isUrl) {
          return defaultDom;
        }
        const linkClick = menuItemProps.isMobile === true ? (handleMenuCollapse) : undefined;
        return <Link to={menuItemProps.path} onClick={linkClick}>{defaultDom}</Link>;
      }}
    >
    </ProLayout>
  );
};
RackNerd Billboard Banner
Share node:
/// .RELATED.DATA_STREAMSShared tags

Related posts

Scanning_database_for_correlations…

/// .UPLINK.SUBSCRIBE

Keep your deck synced with every new transmission from ATLASSC.NET. Subscribe over RSS or Atom, or wire the whole archive straight into your AI assistant with the MCP server.