import React from "react"; import { NavBar, SafeArea, TabBar, Toast } from "antd-mobile"; import { useNavigate, useLocation } from "react-router-dom"; import { User, CattleZodiac } from "@icon-park/react"; import "./index.less"; interface MainLayoutProps { children: React.ReactNode; isShowNavBar?: boolean; title?: string; onLink?: () => void; } const MainLayout: React.FC = ({ isShowNavBar, children, onLink, title, }) => { const navigate = useNavigate(); const location = useLocation(); const { pathname } = location; const [activeKey, setActiveKey] = React.useState(pathname); const setRouteActive = (value: string) => { if (value !== "/") { Toast.show("待开发"); } }; const tabs = [ { key: "/", title: "宠物翻译", icon: , }, { key: "/set", title: "待办", icon: , }, { key: "/message", title: "消息", icon: , }, { key: "/me", title: "我的", icon: , }, ]; const goBack = () => { if (onLink) { onLink?.(); } else { navigate(-1); } }; return (
{isShowNavBar ? {title} : ""}
{children}
{/* setRouteActive(value)} safeArea={true} > {tabs.map((item) => ( ))} */}
); }; export default MainLayout;