From 72392e9571e8e35d95d06931f91e4e5e65360f2a Mon Sep 17 00:00:00 2001 From: wenhua <1084668738@qq.com> Date: Mon, 16 Oct 2023 14:28:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=A9=E5=8D=8E:=20=E7=B2=BE=E7=AE=80Layout?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/index.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/layout/index.tsx b/src/layout/index.tsx index f329468..073a1c7 100644 --- a/src/layout/index.tsx +++ b/src/layout/index.tsx @@ -1,28 +1,15 @@ import React, { useEffect } from "react"; import { Layout } from 'antd' -import { useDispatch, useSelector } from 'react-redux' +import { useSelector } from 'react-redux' import SideBar from "./sidebar"; import Navbar from "./navbar"; import AppMain from "./appmain"; import '../assets/styles/layout.scss' -import { addRoutes, getAsyncRouters } from '../stores/permission'; const { Header, Sider, Content } = Layout; export default function LayOut() { const collapsed = useSelector((store: any) => store.sidebar) - const dispatch = useDispatch() - const requestAsyncRoutes = async () => { - const { payload } = await dispatch(getAsyncRouters() as any) - dispatch(addRoutes(payload)) - } - useEffect(()=>{ - requestAsyncRoutes() - }, []) - - window.addEventListener('unload', ()=>{ - requestAsyncRoutes() - }) return(