|
|
@ -38,6 +38,25 @@ const getRedirect = (item) => { |
|
|
}; |
|
|
}; |
|
|
getMenuData().forEach(getRedirect); |
|
|
getMenuData().forEach(getRedirect); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取面包屑映射 |
|
|
|
|
|
* @param {Object} menuData 菜单配置 |
|
|
|
|
|
* @param {Object} routerData 路由配置 |
|
|
|
|
|
*/ |
|
|
|
|
|
const getBreadcrumbNameMap = (menuData, routerData) => { |
|
|
|
|
|
const result = {}; |
|
|
|
|
|
const childResult = {}; |
|
|
|
|
|
for (const i of menuData) { |
|
|
|
|
|
if (!routerData[i.path]) { |
|
|
|
|
|
result[i.path] = i; |
|
|
|
|
|
} |
|
|
|
|
|
if (i.children) { |
|
|
|
|
|
Object.assign(childResult, getBreadcrumbNameMap(i.children, routerData)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return Object.assign({}, routerData, result, childResult); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const query = { |
|
|
const query = { |
|
|
'screen-xs': { |
|
|
'screen-xs': { |
|
|
maxWidth: 575, |
|
|
maxWidth: 575, |
|
|
@ -76,7 +95,7 @@ class BasicLayout extends React.PureComponent { |
|
|
const { location, routerData } = this.props; |
|
|
const { location, routerData } = this.props; |
|
|
return { |
|
|
return { |
|
|
location, |
|
|
location, |
|
|
breadcrumbNameMap: routerData, |
|
|
breadcrumbNameMap: getBreadcrumbNameMap(getMenuData(), routerData), |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
componentDidMount() { |
|
|
componentDidMount() { |
|
|
|