diff --git a/src/common/menu.js b/src/common/menu.js
index 8293907383cac7284cef319d58397336c02ec1ee..fc6ae8ccd5c4e491e48e911219a638ef6bcc6d3f 100644
--- a/src/common/menu.js
+++ b/src/common/menu.js
@@ -371,19 +371,22 @@ const menuData = [
},
];
-function formatter(data, parentPath = '/', parentAuthority) {
+function formatter(data, parentPath = '/', parentAuthority, parentName) {
return data.map(item => {
let { path } = item;
+ const id = parentName ? `${parentName}.${item.name}` : `menu.${item.name}`;
+
if (!isUrl(path)) {
path = parentPath + item.path;
}
const result = {
...item,
path,
+ locale: id,
authority: item.authority || parentAuthority,
};
if (item.children) {
- result.children = formatter(item.children, `${parentPath}${item.path}/`, item.authority);
+ result.children = formatter(item.children, `${parentPath}${item.path}/`, item.authority, id);
}
return result;
});
diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js
index fb86f7651db920fb74c03493e5ca64c703f89ad9..5539f49dc73ce4456c14f17ae4c5d22b766e5e98 100644
--- a/src/components/SiderMenu/BaseMenu.js
+++ b/src/components/SiderMenu/BaseMenu.js
@@ -79,10 +79,9 @@ export default class BaseMenu extends PureComponent {
/**
* get SubMenu or Item
*/
- getSubMenuOrItem = (item, parent) => {
- const id = parent ? `${parent}.${item.name}` : `menu.${item.name}`;
+ getSubMenuOrItem = item => {
if (item.children && item.children.some(child => child.name)) {
- const name = ;
+ const name = ;
return (
- {this.getNavMenuItems(item.children, id)}
+ {this.getNavMenuItems(item.children)}
);
} else {
- return
{this.getMenuItemPath(item, parent)};
+ return {this.getMenuItemPath(item)};
}
};
@@ -110,9 +109,8 @@ export default class BaseMenu extends PureComponent {
* Judge whether it is http link.return a or Link
* @memberof SiderMenu
*/
- getMenuItemPath = (item, parent) => {
- const id = parent ? `${parent}.${item.name}` : `menu.${item.name}`;
- const name = ;
+ getMenuItemPath = item => {
+ const name = ;
const itemPath = this.conversionPath(item.path);
const icon = getIcon(item.icon);
const { target } = item;
diff --git a/src/components/SiderMenu/SliderMenu.js b/src/components/SiderMenu/SliderMenu.js
index 5dc9eb6020914524fd6e539a61646b70c5ec951e..cee42b131b75b5106a4c1df826f3d11b74acf09f 100644
--- a/src/components/SiderMenu/SliderMenu.js
+++ b/src/components/SiderMenu/SliderMenu.js
@@ -105,17 +105,16 @@ export default class SiderMenu extends PureComponent {
* @memberof SiderMenu
*/
getMenuItemPath = item => {
- console.log(item);
const itemPath = this.conversionPath(item.path);
const icon = getIcon(item.icon);
- const { target, name } = item;
+ const { target, name, locale } = item;
// Is it a http link
if (/^https?:\/\//.test(itemPath)) {
return (
{icon}
-
+
);
@@ -136,7 +135,7 @@ export default class SiderMenu extends PureComponent {
>
{icon}
-
+
);
@@ -159,7 +158,7 @@ export default class SiderMenu extends PureComponent {
{item.name}
) : (
- item.name
+
)
}
key={item.path}
diff --git a/src/locale/en-US.js b/src/locale/en-US.js
index aecec5c9e1afbaed98fa72b6bcaa4e440ecf89de..3a22caf6a7b7758170c7c175eaf282f1c0eb4077 100644
--- a/src/locale/en-US.js
+++ b/src/locale/en-US.js
@@ -7,7 +7,7 @@ export default {
data: appLocaleData,
antd: antdEn,
messages: {
- 'menu.home': 'home',
+ 'menu.home': 'Home',
'menu.dashboard': 'Dashboard',
'menu.dashboard.analysis': 'Analysis',
'menu.dashboard.monitor': 'Monitor',