From c4524c8b898712575ced565c7ddb475743457031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Sun, 15 Jul 2018 00:56:01 +0800 Subject: [PATCH] bugfix: TableList name searchlist change to searchtable --- config/config.js | 2 +- src/locales/en-US.js | 7 ++++--- src/locales/zh-CN.js | 3 ++- src/pages/layouts/BasicLayout.js | 4 ++-- src/pages/layouts/LoadingPage.js | 7 +++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/config/config.js b/config/config.js index 50583880..082abe85 100644 --- a/config/config.js +++ b/config/config.js @@ -97,7 +97,7 @@ export default { icon: 'table', name: 'list', routes: [ - { path: '/list/table-list', name: 'searchlist', component: './List/TableList' }, + { path: '/list/table-list', name: 'searchtable', component: './List/TableList' }, { path: '/list/basic-list', name: 'basiclist', component: './List/BasicList' }, { path: '/list/card-list', name: 'cardlist', component: './List/CardList' }, { diff --git a/src/locales/en-US.js b/src/locales/en-US.js index 6dec9709..b3decf2f 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -13,12 +13,13 @@ export default { 'menu.form.stepform.result': 'Step Form(finished)', 'menu.form.advancedform': 'Advanced Form', 'menu.list': 'List', - 'menu.list.searchlist': 'Search List', + 'menu.list.searchtable': 'Search Table', 'menu.list.basiclist': 'Basic List', 'menu.list.cardlist': 'Card List', + 'menu.list.searchlist': 'Search List', 'menu.list.searchlist.articles': 'Search List(articles)', - 'menu.list.searchlist.projects': 'Search List(projects)', - 'menu.list.searchlist.applications': 'Search List(applications)', + 'menu.list.searchlist.projects': 'Search List(projects)', + 'menu.list.searchlist.applications': 'Search List(applications)', 'menu.profile': 'Profile', 'menu.profile.basic': 'Basic Profile', 'menu.profile.advanced': 'Advanced Profile', diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js index ebb50b71..b8da6e95 100644 --- a/src/locales/zh-CN.js +++ b/src/locales/zh-CN.js @@ -15,9 +15,10 @@ export default { 'menu.form.stepform.result': '分步表单(完成)', 'menu.form.advancedform': '高级表单', 'menu.list': '列表页', - 'menu.list.searchlist': '搜索列表', + 'menu.list.searchtable': '查询表格', 'menu.list.basiclist': '标准列表', 'menu.list.cardlist': '卡片列表', + 'menu.list.searchlist': '搜索列表', 'menu.list.searchlist.articles': '搜索列表(文章)', 'menu.list.searchlist.projects': '搜索列表(项目)', 'menu.list.searchlist.applications': '搜索列表(应用)', diff --git a/src/pages/layouts/BasicLayout.js b/src/pages/layouts/BasicLayout.js index 9f69353f..a3b82214 100644 --- a/src/pages/layouts/BasicLayout.js +++ b/src/pages/layouts/BasicLayout.js @@ -26,10 +26,11 @@ const getBreadcrumbNameMap = memoizeOne(meun => { const routerMap = {}; const mergeMeunAndRouter = meunData => { meunData.forEach(meunItem => { - routerMap[meunItem.path] = meunItem; if (meunItem.children) { mergeMeunAndRouter(meunItem.children); } + // Reduce memory usage + routerMap[meunItem.path] = meunItem; }); }; mergeMeunAndRouter(meun); @@ -66,7 +67,6 @@ class BasicLayout extends React.PureComponent { super(props); const { menuData } = this.props; this.getPageTitle = memoizeOne(this.getPageTitle); - console.log(getBreadcrumbNameMap(menuData)); this.breadcrumbNameMap = getBreadcrumbNameMap(menuData); } diff --git a/src/pages/layouts/LoadingPage.js b/src/pages/layouts/LoadingPage.js index 5fd58cd6..5f1dadf0 100644 --- a/src/pages/layouts/LoadingPage.js +++ b/src/pages/layouts/LoadingPage.js @@ -7,7 +7,7 @@ import BasicLayout from './BasicLayout'; import config from '../../../config/config'; const menuData = config['routes']; -// change router to menu. +// Conversion router to menu. function formatter(data, parentPath = '', parentAuthority, parentName) { return data.map(item => { const id = parentName ? `${parentName}.${item.name}` : `menu.${item.name}`; @@ -17,8 +17,11 @@ function formatter(data, parentPath = '', parentAuthority, parentName) { authority: item.authority || parentAuthority, }; if (item.routes) { - result.children = formatter(item.routes, `${parentPath}${item.path}/`, item.authority, id); + const children = formatter(item.routes, `${parentPath}${item.path}/`, item.authority, id); + // Reduce memory usage + result.children = children; } + delete result.routes; return result; }); } -- GitLab