import React, { useMemo } from 'react'; import { useRouter } from 'next/router'; import MyIcon from '../Icon'; import { Flex } from '@chakra-ui/react'; import { useChatStore } from '@/store/chat'; const NavbarPhone = () => { const router = useRouter(); const { lastChatModelId, lastChatId } = useChatStore(); const navbarList = useMemo( () => [ { label: '聊天', icon: 'tabbarChat', link: `/chat?modelId=${lastChatModelId}&chatId=${lastChatId}`, activeLink: ['/chat'] }, { label: 'AI助手', icon: 'tabbarModel', link: `/model`, activeLink: ['/model'] }, { label: '发现', icon: 'tabbarMore', link: '/tools', activeLink: ['/tools'] }, { label: '我', icon: 'tabbarMe', link: '/number', activeLink: ['/number'] } ], [lastChatId, lastChatModelId] ); return ( <> {navbarList.map((item) => ( { if (item.link === router.asPath) return; router.push(item.link); }} > ))} ); }; export default NavbarPhone;