Skip to content

Commit

Permalink
js format
Browse files Browse the repository at this point in the history
  • Loading branch information
zuiidea committed Feb 14, 2017
1 parent b9f8912 commit 702b3cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
15 changes: 6 additions & 9 deletions src/components/layout/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Menus ({ siderFold, darkTheme, location, isNavbar, handleClickNavMenu,
const onOpenChange = (openKeys) => {
const latestOpenKey = openKeys.find(key => !(navOpenKeys.indexOf(key) > -1))
const latestCloseKey = navOpenKeys.find(key => !(openKeys.indexOf(key) > -1))
let nextOpenKeys = [];
let nextOpenKeys = []
if (latestOpenKey) {
nextOpenKeys = getAncestorKeys(latestOpenKey).concat(latestOpenKey)
}
Expand All @@ -43,18 +43,15 @@ function Menus ({ siderFold, darkTheme, location, isNavbar, handleClickNavMenu,
}
const getAncestorKeys = (key) => {
const map = {
// navChildParent: ['navParent'],
navigation2: ['navigation']
}
return map[key] || []
}
let menuProps = {}
if(!siderFold) {//菜单栏收起时,不能操作openKeys
menuProps = {
onOpenChange: onOpenChange,
openKeys: navOpenKeys
}
}
// 菜单栏收起时,不能操作openKeys
let menuProps = !siderFold ? {
onOpenChange,
openKeys: navOpenKeys
} : {}

return (
<Menu
Expand Down
4 changes: 2 additions & 2 deletions src/routes/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function App ({children, location, dispatch, app}) {
switchSider () {
dispatch({type: 'app/switchSider'})
},
changeOpenKeys(openKeys) {
changeOpenKeys (openKeys) {
localStorage.setItem('navOpenKeys', JSON.stringify(openKeys))
dispatch({ type: 'app/handleNavOpenKeys', payload: { navOpenKeys: openKeys } })
}
Expand All @@ -50,7 +50,7 @@ function App ({children, location, dispatch, app}) {
changeTheme () {
dispatch({type: 'app/changeTheme'})
},
changeOpenKeys(openKeys) {
changeOpenKeys (openKeys) {
localStorage.setItem('navOpenKeys', JSON.stringify(openKeys))
dispatch({ type: 'app/handleNavOpenKeys', payload: { navOpenKeys: openKeys } })
}
Expand Down

0 comments on commit 702b3cc

Please sign in to comment.