Commit bba32aa7 authored by ddcat1115's avatar ddcat1115

fix #560

parent 9ace75b9
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Layout, Menu, Icon } from 'antd'; import { Layout, Menu, Icon } from 'antd';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
import logo from '../../assets/logo.svg';
import styles from './index.less'; import styles from './index.less';
import { getMenuData } from '../../common/menu';
const { Sider } = Layout; const { Sider } = Layout;
const { SubMenu } = Menu; const { SubMenu } = Menu;
...@@ -11,7 +9,7 @@ const { SubMenu } = Menu; ...@@ -11,7 +9,7 @@ const { SubMenu } = Menu;
export default class SiderMenu extends PureComponent { export default class SiderMenu extends PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.menus = getMenuData(); this.menus = props.menuData;
this.state = { this.state = {
openKeys: this.getDefaultCollapsedSubMenus(props), openKeys: this.getDefaultCollapsedSubMenus(props),
}; };
...@@ -131,7 +129,7 @@ export default class SiderMenu extends PureComponent { ...@@ -131,7 +129,7 @@ export default class SiderMenu extends PureComponent {
}); });
} }
render() { render() {
const { collapsed, location: { pathname }, onCollapse } = this.props; const { logo, collapsed, location: { pathname }, onCollapse } = this.props;
const { openKeys } = this.state; const { openKeys } = this.state;
// Don't show popup menu when it is been collapsed // Don't show popup menu when it is been collapsed
const menuProps = collapsed ? {} : { const menuProps = collapsed ? {} : {
......
...@@ -129,6 +129,8 @@ class BasicLayout extends React.PureComponent { ...@@ -129,6 +129,8 @@ class BasicLayout extends React.PureComponent {
const layout = ( const layout = (
<Layout> <Layout>
<SiderMenu <SiderMenu
logo={logo}
menuData={getMenuData()}
collapsed={collapsed} collapsed={collapsed}
location={location} location={location}
isMobile={this.state.isMobile} isMobile={this.state.isMobile}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment