import { memo, useMemo } from 'react' import type { FC, ReactNode } from 'react' import { useLocation, useOutlet } from 'react-router-dom' import LeftMenu from './components/leftMenu' import { SwitchTransition, CSSTransition } from 'react-transition-group' interface Iprops { children?: ReactNode } const Home: FC = () => { const location = useLocation() const currentOutlet = useOutlet() const key = useMemo(() => { const index = location.pathname.lastIndexOf('/') const partentPath = location.pathname.slice(0, index) return partentPath === '/home' ? location.pathname : partentPath }, [location.pathname]) return (
{/* 头部 */}
{/* 侧边栏 */}
{/* 路由出口 */}
{/* 过渡动画 */} {currentOutlet && ( {currentOutlet} )}
) } export default memo(Home)