5 Commits
1ec501b38f
...
bdd3352646
Author | SHA1 | Message | Date |
---|---|---|---|
|
bdd3352646 |
外层套一层AppTab
|
4 months ago |
|
78faf191a8 |
半径 默认值空
|
4 months ago |
|
707d201736 |
上传记录 隐藏「更多操作」
|
4 months ago |
|
854c85d007 |
测量记录删除确认
|
4 months ago |
|
6add02850b |
测量详情页面滚动
|
4 months ago |
10 changed files with 175 additions and 129 deletions
-
104src/App.tsx
-
77src/AppTab.tsx
-
7src/index.tsx
-
13src/pages/Measure.tsx
-
66src/pages/MeasureRecord.tsx
-
1src/pages/MeasureSave.tsx
-
12src/pages/MeasurementList.tsx
-
15src/pages/UploadList.tsx
-
1src/services/apiTypes.ts
-
8src/setupProxy.js
@ -0,0 +1,77 @@ |
|||
import React from 'react'; |
|||
import { Outlet, useLocation, useNavigate } from 'react-router'; |
|||
import { SafeArea, TabBar } from 'antd-mobile'; |
|||
|
|||
import icon_1_s from './assets/tabIcon/icon_tab1_s.svg'; |
|||
import icon_1_u from './assets/tabIcon/icon_tab1_u.svg'; |
|||
// import icon_2_s from './assets/tabIcon/icon_tab2_s.svg';
|
|||
// import icon_2_u from './assets/tabIcon/icon_tab2_u.svg';
|
|||
import icon_3_s from './assets/tabIcon/icon_tab3_s.svg'; |
|||
import icon_3_u from './assets/tabIcon/icon_tab3_u.svg'; |
|||
import icon_4_s from './assets/tabIcon/icon_tab4_s.svg'; |
|||
import icon_4_u from './assets/tabIcon/icon_tab4_u.svg'; |
|||
|
|||
const BottomBar = () => { |
|||
const navigate = useNavigate(); |
|||
const location = useLocation(); |
|||
const { pathname } = location; |
|||
const setRouteActive = (value: string) => { |
|||
navigate(value, { replace: true }); |
|||
}; |
|||
|
|||
const tabs = [ |
|||
{ |
|||
key: '/home/measure', |
|||
title: '测量', |
|||
icon_s: icon_1_s, |
|||
icon_n: icon_1_u, |
|||
}, |
|||
// {
|
|||
// key: '/home/setting',
|
|||
// title: '设置',
|
|||
// icon_s: icon_2_s,
|
|||
// icon_n: icon_2_u,
|
|||
// },
|
|||
{ |
|||
key: '/home/bluetooth', |
|||
title: '蓝牙', |
|||
icon_s: icon_3_s, |
|||
icon_n: icon_3_u, |
|||
}, |
|||
{ |
|||
key: '/home/mine', |
|||
title: '我的', |
|||
icon_s: icon_4_s, |
|||
icon_n: icon_4_u, |
|||
}, |
|||
]; |
|||
|
|||
return ( |
|||
<TabBar activeKey={pathname} onChange={(value) => setRouteActive(value)}> |
|||
{tabs.map((item) => ( |
|||
<TabBar.Item |
|||
key={item.key} |
|||
icon={(active: boolean) => |
|||
active ? <img src={item.icon_s} alt="icon" /> : <img src={item.icon_n} alt="icon" /> |
|||
} |
|||
title={item.title} |
|||
/> |
|||
))} |
|||
</TabBar> |
|||
); |
|||
}; |
|||
|
|||
export default function AppTab() { |
|||
return ( |
|||
<div className="App"> |
|||
<SafeArea position="top" /> |
|||
<div> |
|||
<Outlet /> |
|||
</div> |
|||
<div className="border-t border-[#ebebeb]"> |
|||
<BottomBar /> |
|||
</div> |
|||
<SafeArea position="bottom" /> |
|||
</div> |
|||
); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue