assistant-todo-mobile/src/pages/Bottom/index.js

71 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-01-12 08:47:39 -05:00
import React ,{FC} from "react";
import { NavBar, TabBar } from 'antd-mobile'
import {
Route,Routes,
useLocation,
MemoryRouter as Router,
useNavigate,
} from 'react-router-dom'
import {
AppOutline,
MessageOutline,
UnorderedListOutline,
UserOutline,
} from 'antd-mobile-icons'
export function Bottom (){
const navigate = useNavigate();
const location = useLocation()
const { pathname } = location
const setRouteActive = (value) => {
navigate(value)
}
const tabs = [
{
key: '/home',
title: '首页',
icon: <AppOutline />,
2023-01-14 02:09:13 -05:00
badge: '1',
2023-01-12 08:47:39 -05:00
},
{
key: '/todo',
title: '待办',
icon: <UnorderedListOutline />,
2023-01-14 02:09:13 -05:00
badge: '2',
2023-01-12 08:47:39 -05:00
},
{
key: '/message',
title: '消息',
icon: <MessageOutline />,
2023-01-14 02:09:13 -05:00
badge: '3',
2023-01-12 08:47:39 -05:00
},
{
key: '/me',
title: '我的',
icon: <UserOutline />,
2023-01-14 02:09:13 -05:00
badge: '4',
2023-01-12 08:47:39 -05:00
},
]
return (
<TabBar activeKey={pathname} onChange={value => setRouteActive(value)}>
{tabs.map(item => (
2023-01-14 02:09:13 -05:00
<TabBar.Item key={item.key} icon={item.icon} title={item.title} badge= {item.badge}/>
2023-01-12 08:47:39 -05:00
))}
</TabBar>
)
}
2023-01-14 02:09:13 -05:00
2023-01-12 08:47:39 -05:00
export function Todo() {
return <div>待办</div>
}
export function Message() {
return <div>消息</div>
}
export function PersonalCenter() {
return <div>我的</div>
}