Commit e4af6926 authored by chenshouchao's avatar chenshouchao

feat: 修改菜单样式

parent c18706a9
...@@ -8,7 +8,30 @@ ...@@ -8,7 +8,30 @@
width: 10%; width: 10%;
min-width: 220px; min-width: 220px;
height: calc(100vh - 57px); height: calc(100vh - 57px);
background-color: #f7f8fa;
} }
.content { .content {
flex: 1; flex: 1;
} }
.list {
/* background-color: red; */
}
.listItem {
padding: 8px 25px;
height: 38px;
box-sizing: border-box;
cursor: pointer;
color: #565c66;
font-size: 14px;
line-height: 22px;
}
.listItem:hover {
border-left: 3px solid #1370ff;
color: #1370ff;
background-color: #ebedf0;
}
.active {
border-left: 3px solid #1370ff;
color: #1370ff;
background-color: #ebedf0;
}
import { import { Box, List } from "@mui/material";
Box,
List,
ListItem,
ListItemText,
ListItemButton,
} from "@mui/material";
// import CurrentProject from "./CurrentProject"; // import CurrentProject from "./CurrentProject";
import CurrentProject from "../Project/components/CurrentProject"; import CurrentProject from "../Project/components/CurrentProject";
import React from "react"; import React from "react";
...@@ -12,9 +6,17 @@ import { Outlet, useNavigate } from "react-router-dom"; ...@@ -12,9 +6,17 @@ import { Outlet, useNavigate } from "react-router-dom";
import style from "./index.module.css"; import style from "./index.module.css";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useStores } from "@/store/index"; import { useStores } from "@/store/index";
import { toJS } from "mobx";
import classnames from "classnames";
const MenuLayout = observer(() => { const MenuLayout = observer(() => {
const { permissionStore } = useStores(); const { permissionStore } = useStores();
console.log("11111111111111111111", toJS(permissionStore));
console.log("11111111111111111111", toJS(permissionStore.sidebarRouters));
console.log(new URL(window.location.href));
console.log(new URL(window.location.href).pathname);
let pathname = new URL(window.location.href).pathname;
const navigate = useNavigate(); const navigate = useNavigate();
...@@ -22,16 +24,28 @@ const MenuLayout = observer(() => { ...@@ -22,16 +24,28 @@ const MenuLayout = observer(() => {
<Box className={style.container}> <Box className={style.container}>
<Box className={style.aside}> <Box className={style.aside}>
<CurrentProject /> <CurrentProject />
<List> <List className={style.list}>
{permissionStore.sidebarRouters.map((item, index) => { {permissionStore.sidebarRouters.map((item, index) => {
return ( return (
<ListItem key={"sidebar" + index}> <li
<ListItemButton key={"sidebar" + index}
onClick={() => item.type === "page" && navigate(item.path)} // className={style.listItem}
> className={classnames({
<ListItemText>{item.name}</ListItemText> [style.listItem]: true,
</ListItemButton> [style.active]: item.path === pathname,
</ListItem> })}
onClick={() => item.type === "page" && navigate(item.path)}
>
{item.name}
</li>
// <ListItem key={"sidebar" + index} className={style.listItem}>
// <ListItemButton
// onClick={() => item.type === "page" && navigate(item.path)}
// >
// <ListItemText>{item.name}</ListItemText>
// </ListItemButton>
// </ListItem>
); );
})} })}
</List> </List>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment