"use client" import React from 'react' import { NavBar, TabBar,Image,Icon } from 'antd-mobile' import { AppOutline, MessageOutline, UnorderedListOutline, UserOutline, } from 'antd-mobile-icons' import './index.css' import { usePathname, useRouter } from 'next/navigation' export default function BottomNav(){ // const history = useHistory() // const location = useLocation() // const { pathname } = location // const setRouteActive = (value) => { // history.push(value) // } const pathname = usePathname() const router = useRouter() const setRouteActive = (value) => { router.push(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 => ( ))} ) }