Fix es6 function

This commit is contained in:
afc163 2016-03-30 22:51:30 +08:00
parent 3aab04d4a5
commit 8c5c458304
2 changed files with 7 additions and 4 deletions

View File

@ -119,8 +119,11 @@ export default class MainContent extends React.Component {
getFooterNav(menuItems, activeMenuItem) {
const menuItemsList = this.flattenMenu(menuItems);
const activeMenuItemIndex = menuItemsList.findIndex((menuItem) => {
return menuItem.key === activeMenuItem;
let activeMenuItemIndex = -1;
menuItemsList.forEach((menuItem, i) => {
if (menuItem.key === activeMenuItem) {
activeMenuItemIndex = i;
}
});
const prev = menuItemsList[activeMenuItemIndex - 1];
const next = menuItemsList[activeMenuItemIndex + 1];

View File

@ -51,9 +51,9 @@ export function generateContainer(data) {
export function generateIndex(data) {
const menuItems = getMenuItems(data);
const firstChild = menuItems.topLevel.topLevel.find((item) => {
const firstChild = menuItems.topLevel.topLevel.filter((item) => {
return item.disabled !== 'true';
});
})[0];
return (
<IndexRedirect key="index"
to={fileNameToPath(firstChild.fileName)} />