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