import React from 'react' import { Avatar, Dropdown } from 'antd' import { logo } from '@/config' import { useAuth } from '@/hooks' import { Layout, Menu } from 'antd' import { LogoutOutlined, SettingOutlined, UserOutlined, } from '@ant-design/icons' import { useHistory } from 'react-router-dom' const { Header } = Layout export interface HeaderProps { headerHeight?: number | string collapsed?: boolean siderWidth?: string | number theme?: string style?: Record } const CustomHeader: React.FC = (props) => { const { headerHeight, collapsed, siderWidth, theme = 'light', children, style, } = props const history = useHistory() const auth = useAuth() const width = `calc(100% - ${collapsed ? 48 : siderWidth}px)` const logout = () => { auth.logout(() => { history.replace('/login') }) } const menuHeaderDropdown = ( 个人中心 个人设置 退出登录 ) return ( <> {/*空的占位*/}
{children}
{auth.user?.username}
) } export default CustomHeader