mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-19 08:55:23 +00:00
url active menu
This commit is contained in:
@@ -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 (
|
||||
<div>
|
||||
<div className={styles.logo}>
|
||||
@@ -38,7 +39,7 @@ function Sider({ siderFold,darkTheme,changeTheme }) {
|
||||
<Menu
|
||||
mode={siderFold?"vertical":"inline"}
|
||||
theme={darkTheme?"dark":"light"}
|
||||
defaultSelectedKeys={['dashboard']}>
|
||||
defaultSelectedKeys={[location.pathname.split('/')[location.pathname.split('/').length - 1]||'dashboard']}>
|
||||
{getMenus(menu,siderFold)}
|
||||
</Menu>
|
||||
{!siderFold?<div className={styles.switchtheme}>
|
||||
|
||||
+1
-1
@@ -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'})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user