diff --git a/components/BottomNav/index.js b/components/BottomNav/index.js
index 204cae0..14a4625 100644
--- a/components/BottomNav/index.js
+++ b/components/BottomNav/index.js
@@ -1,58 +1,103 @@
-"use client"
+"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 => (
-
- ))}
-
- )
-}
\ No newline at end of file
+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) => (
+
+ ))}
+
+ );
+}