diff --git a/src/components/layout/sider.jsx b/src/components/layout/sider.jsx index f426598..fa85b1a 100644 --- a/src/components/layout/sider.jsx +++ b/src/components/layout/sider.jsx @@ -28,7 +28,8 @@ const getMenus = function (menuArray,siderFold,parentPath) { }) } -function Sider({ siderFold,darkTheme,changeTheme }) { +function Sider({ siderFold,darkTheme,location,changeTheme }) { + console.log(location); return (
@@ -38,7 +39,7 @@ function Sider({ siderFold,darkTheme,changeTheme }) { + defaultSelectedKeys={[location.pathname.split('/')[location.pathname.split('/').length - 1]||'dashboard']}> {getMenus(menu,siderFold)} {!siderFold?
diff --git a/src/routes/app.js b/src/routes/app.js index a0edefc..97d735e 100644 --- a/src/routes/app.js +++ b/src/routes/app.js @@ -22,7 +22,6 @@ function App({children, location, dispatch, app}) { const headerProps = { user, - location, siderFold, logout() { dispatch({type: 'app/logout'}) @@ -35,6 +34,7 @@ function App({children, location, dispatch, app}) { const siderProps = { siderFold, darkTheme, + location, changeTheme(){ dispatch({type: 'app/changeTheme'}) }