Skip to content

Commit

Permalink
fix(antdsite): fix an erro in mobile mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyi7099 committed Aug 10, 2019
1 parent 5822bd6 commit cadac37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/antdsite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antdsite",
"version": "0.3.0",
"version": "0.3.1",
"description": "A static docs generator based on Ant Design and GatsbyJs",
"homepage": "https://github.com/YvesCoding/antdsite",
"repository": {
Expand Down
10 changes: 5 additions & 5 deletions packages/antdsite/src/default-theme/components/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default class LeftMenu extends React.PureComponent<MenuPros, MenuState> {
};
}

menuItems: Array<React.Component> = [];

componentDidMount() {
this.getPreAndNext();

Expand All @@ -61,8 +63,7 @@ export default class LeftMenu extends React.PureComponent<MenuPros, MenuState> {

getPreAndNext = () => {
const { currentPath } = this.props || [];
const menu = this.refs.menu as React.Component;
const menuItems = menu.props.children || [];
const menuItems = this.menuItems || [];

function filterItem(items: any) {
return items.length
Expand Down Expand Up @@ -183,19 +184,18 @@ export default class LeftMenu extends React.PureComponent<MenuPros, MenuState> {
const { currentPath, menuList, isMobile } = this.props;
const { openKeys } = this.state;
const activeMenuItem = getActiveMenuItem(currentPath, menuList);
const menuItems = this.getMenuItems();
this.menuItems = this.getMenuItems();

const menuChild = (
<Menu
ref="menu"
inlineIndent={40}
className="aside-container"
mode="inline"
openKeys={openKeys}
selectedKeys={[(activeMenuItem && activeMenuItem.slug) || '/']}
onOpenChange={this.handleMenuOpenChange}
>
{menuItems}
{this.menuItems}
</Menu>
);

Expand Down

0 comments on commit cadac37

Please sign in to comment.