feat: into
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
import React from "react";
|
||||
import { NavBar, SafeArea, Toast } from "antd-mobile";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import { User, CattleZodiac } from "@icon-park/react";
|
||||
import { User, CattleZodiac, Right } from "@icon-park/react";
|
||||
import "./index.less";
|
||||
|
||||
interface MainLayoutProps {
|
||||
children: React.ReactNode;
|
||||
isShowNavBar?: boolean;
|
||||
title?: string;
|
||||
navBarRight?: React.ReactNode;
|
||||
onLink?: () => void;
|
||||
}
|
||||
|
||||
const MainLayout: React.FC<MainLayoutProps> = ({ isShowNavBar, children, onLink, title }) => {
|
||||
const MainLayout: React.FC<MainLayoutProps> = ({
|
||||
isShowNavBar,
|
||||
children,
|
||||
onLink,
|
||||
title,
|
||||
navBarRight,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
// const location = useLocation();
|
||||
|
||||
@@ -40,6 +47,10 @@ const MainLayout: React.FC<MainLayoutProps> = ({ isShowNavBar, children, onLink,
|
||||
// ];
|
||||
|
||||
const goBack = () => {
|
||||
// 打印路由栈
|
||||
|
||||
|
||||
// debugger;
|
||||
if (onLink) {
|
||||
onLink?.();
|
||||
} else {
|
||||
@@ -49,7 +60,13 @@ const MainLayout: React.FC<MainLayoutProps> = ({ isShowNavBar, children, onLink,
|
||||
return (
|
||||
<div className="main-layout">
|
||||
<SafeArea position="top" />
|
||||
{isShowNavBar ? <NavBar onBack={goBack}>{title}</NavBar> : ""}
|
||||
{isShowNavBar ? (
|
||||
<NavBar onBack={goBack} right={navBarRight}>
|
||||
{title}
|
||||
</NavBar>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
<div className="layout-content">{children}</div>
|
||||
|
||||
<div className="footer layout-tab">
|
||||
|
||||
Reference in New Issue
Block a user