"use client";
import React from "react";
import { TabBar, Image } from "antd-mobile";
import "./index.css";
import { usePathname, useRouter } from "next/navigation";
export default function BottomNav() {
const pathname = usePathname();
const router = useRouter();
const setRouteActive = (value) => {
router.replace(value);
};
const tabs = [
{
key: "/",
title: "广场",
icon: (
),
activeIcon: (
),
},
{
key: "/space",
title: "空间",
icon: (
),
activeIcon: (
),
},
{
key: "/my",
title: "我的",
icon: (
),
activeIcon: (
),
},
];
const checkPath = () => {
const pathnames = ["/", "/space", "/my"];
const isActive = pathnames.some((path) => path === pathname);
return isActive;
};
return (
setRouteActive(value)}
className={!checkPath() ? "hidden" : ""}
>
{tabs.map((item) => (
))}
);
}