mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-20 14:45:09 +08:00
部门报错优化
This commit is contained in:
parent
7f4a08f7a4
commit
d9d3be1434
@ -30,23 +30,25 @@ export const Header: React.FC = () => {
|
|||||||
const [currentNav, serCurrentNav] = useState(location.pathname);
|
const [currentNav, serCurrentNav] = useState(location.pathname);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentDepartment(departments[0].name);
|
if (departments.length > 0) {
|
||||||
const arr: any = [
|
setCurrentDepartment(departments[0].name);
|
||||||
{
|
const arr: any = [
|
||||||
key: "1",
|
{
|
||||||
type: "group",
|
key: "1",
|
||||||
label: "部门",
|
type: "group",
|
||||||
children: [],
|
label: "部门",
|
||||||
},
|
children: [],
|
||||||
];
|
},
|
||||||
departments.map((item: any) => {
|
];
|
||||||
arr[0].children.push({
|
departments.map((item: any) => {
|
||||||
key: item.id,
|
arr[0].children.push({
|
||||||
label: item.name,
|
key: item.id,
|
||||||
disabled: item.name === currentDepartment,
|
label: item.name,
|
||||||
|
disabled: item.name === currentDepartment,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
setDepartmentsMenu(arr);
|
||||||
setDepartmentsMenu(arr);
|
}
|
||||||
}, [departments]);
|
}, [departments]);
|
||||||
|
|
||||||
const onClick: MenuProps["onClick"] = ({ key }) => {
|
const onClick: MenuProps["onClick"] = ({ key }) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user