Commit 9b3ad051 authored by afc163's avatar afc163 Committed by 偏右

fix menu data passing

parent c2fe4009
...@@ -57,8 +57,8 @@ const menuData = formatter(routerConfig[1].routes); ...@@ -57,8 +57,8 @@ const menuData = formatter(routerConfig[1].routes);
*/ */
const getBreadcrumbNameMap = memoizeOne(menu => { const getBreadcrumbNameMap = memoizeOne(menu => {
const routerMap = {}; const routerMap = {};
const mergeMenuAndRouter = () => { const mergeMenuAndRouter = data => {
menuData.forEach(menuItem => { data.forEach(menuItem => {
if (menuItem.children) { if (menuItem.children) {
mergeMenuAndRouter(menuItem.children); mergeMenuAndRouter(menuItem.children);
} }
...@@ -100,8 +100,7 @@ class BasicLayout extends React.PureComponent { ...@@ -100,8 +100,7 @@ class BasicLayout extends React.PureComponent {
super(props); super(props);
this.getPageTitle = memoizeOne(this.getPageTitle); this.getPageTitle = memoizeOne(this.getPageTitle);
// Because there are many places to be. So put it here // Because there are many places to be. So put it here
this.breadcrumbNameMap = getBreadcrumbNameMap(); this.breadcrumbNameMap = getBreadcrumbNameMap(menuData);
console.log(this.breadcrumbNameMap);
} }
state = { state = {
...@@ -133,7 +132,7 @@ class BasicLayout extends React.PureComponent { ...@@ -133,7 +132,7 @@ class BasicLayout extends React.PureComponent {
} }
componentDidUpdate() { componentDidUpdate() {
this.breadcrumbNameMap = getBreadcrumbNameMap(); this.breadcrumbNameMap = getBreadcrumbNameMap(menuData);
} }
componentWillUnmount() { componentWillUnmount() {
...@@ -231,6 +230,7 @@ class BasicLayout extends React.PureComponent { ...@@ -231,6 +230,7 @@ class BasicLayout extends React.PureComponent {
Authorized={Authorized} Authorized={Authorized}
theme={silderTheme} theme={silderTheme}
onCollapse={this.handleMenuCollapse} onCollapse={this.handleMenuCollapse}
menuData={menuData}
{...this.props} {...this.props}
/> />
)} )}
......
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