Commit 02398487 authored by 陈帅's avatar 陈帅

fix #2488, add matchParamsPath default value

parent ebc23423
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
"stylelint-config-standard": "^18.0.0", "stylelint-config-standard": "^18.0.0",
"umi": "^2.1.1", "umi": "^2.1.1",
"umi-plugin-react": "^1.1.1", "umi-plugin-react": "^1.1.1",
"umi-plugin-ga": "^1.1.2" "umi-plugin-ga": "^1.1.3"
}, },
"optionalDependencies": { "optionalDependencies": {
"puppeteer": "^1.9.0" "puppeteer": "^1.9.0"
......
...@@ -21,7 +21,7 @@ import Exception403 from '../pages/Exception/403'; ...@@ -21,7 +21,7 @@ import Exception403 from '../pages/Exception/403';
const { Content } = Layout; const { Content } = Layout;
// Conversion router to menu. // Conversion router to menu.
function formatter(data, parentPath = '', parentAuthority, parentName) { function formatter(data, parentAuthority, parentName) {
return data return data
.map(item => { .map(item => {
let locale = 'menu'; let locale = 'menu';
...@@ -39,12 +39,7 @@ function formatter(data, parentPath = '', parentAuthority, parentName) { ...@@ -39,12 +39,7 @@ function formatter(data, parentPath = '', parentAuthority, parentName) {
authority: item.authority || parentAuthority, authority: item.authority || parentAuthority,
}; };
if (item.routes) { if (item.routes) {
const children = formatter( const children = formatter(item.routes, item.authority, locale);
item.routes,
`${parentPath}${item.path}/`,
item.authority,
locale
);
// Reduce memory usage // Reduce memory usage
result.children = children; result.children = children;
} }
...@@ -176,7 +171,7 @@ class BasicLayout extends React.PureComponent { ...@@ -176,7 +171,7 @@ class BasicLayout extends React.PureComponent {
const pathKey = Object.keys(this.breadcrumbNameMap).find(key => const pathKey = Object.keys(this.breadcrumbNameMap).find(key =>
pathToRegexp(key).test(pathname) pathToRegexp(key).test(pathname)
); );
return this.breadcrumbNameMap[pathKey]; return this.breadcrumbNameMap[pathKey] || {};
}; };
getPageTitle = pathname => { getPageTitle = pathname => {
......
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