2025-06-21 14:55:06 +08:00
|
|
|
|
/**
|
|
|
|
|
* tabbar 选择的策略,更详细的介绍见 tabbar.md 文件
|
|
|
|
|
* 0: 'NATIVE_TABBAR'
|
|
|
|
|
* 2: 'FULL_CUSTOM_TABBAR'
|
|
|
|
|
* 1: 'HALF_CUSTOM_TABBAR'
|
|
|
|
|
* 3: 'NO_TABBAR'
|
|
|
|
|
*
|
|
|
|
|
* 温馨提示:本文件的任何代码更改了之后,都需要重新运行,否则 pages.json 不会更新导致错误
|
|
|
|
|
*/
|
2025-06-21 14:13:30 +08:00
|
|
|
|
|
|
|
|
|
// TODO:通过这里切换使用tabbar的策略
|
2025-06-21 14:46:50 +08:00
|
|
|
|
export const selectedTabbarStrategy = 0
|
2025-06-21 14:55:06 +08:00
|
|
|
|
|
|
|
|
|
// 0 和 1 时,需要tabbar缓存
|
2025-06-21 14:13:30 +08:00
|
|
|
|
export const cacheTabbarEnable = selectedTabbarStrategy < 2
|
2025-06-21 13:09:14 +08:00
|
|
|
|
|
2025-06-21 14:13:30 +08:00
|
|
|
|
// selectedTabbarStrategy==0 时,需要填 iconPath 和 selectedIconPath
|
|
|
|
|
// selectedTabbarStrategy==1 or 2 时,需要填 icon 和 iconType
|
2025-06-21 14:55:06 +08:00
|
|
|
|
// selectedTabbarStrategy==3 时,tabbarList 不生效
|
2025-06-20 21:40:52 +08:00
|
|
|
|
export const tabbarList = [
|
2025-06-20 19:32:34 +08:00
|
|
|
|
{
|
2025-06-21 13:09:14 +08:00
|
|
|
|
iconPath: 'static/tabbar/home.png',
|
|
|
|
|
selectedIconPath: 'static/tabbar/homeHL.png',
|
2025-06-20 19:32:34 +08:00
|
|
|
|
pagePath: 'pages/index/index',
|
2025-06-21 15:26:27 +08:00
|
|
|
|
text: '%tabbar.home%',
|
2025-06-20 19:32:34 +08:00
|
|
|
|
icon: 'home',
|
|
|
|
|
iconType: 'wot',
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-06-21 13:09:14 +08:00
|
|
|
|
iconPath: 'static/tabbar/example.png',
|
|
|
|
|
selectedIconPath: 'static/tabbar/exampleHL.png',
|
2025-06-20 19:32:34 +08:00
|
|
|
|
pagePath: 'pages/about/about',
|
2025-06-21 15:26:27 +08:00
|
|
|
|
text: '%tabbar.about%',
|
2025-06-20 19:32:34 +08:00
|
|
|
|
icon: 'i-carbon-code',
|
2025-06-21 14:36:30 +08:00
|
|
|
|
// 注意 unocss 的图标需要在 页面上引入一下,或者配置到 unocss.config.ts 的 safelist 中
|
2025-06-20 19:32:34 +08:00
|
|
|
|
iconType: 'unocss',
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// pagePath: 'pages/my/index',
|
|
|
|
|
// text: '我的',
|
|
|
|
|
// icon: '/static/logo.svg',
|
|
|
|
|
// iconType: 'local',
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// pagePath: 'pages/mine/index',
|
|
|
|
|
// text: '我的',
|
|
|
|
|
// icon: 'iconfont icon-my',
|
|
|
|
|
// iconType: 'iconfont',
|
|
|
|
|
// },
|
|
|
|
|
]
|
2025-06-20 21:40:52 +08:00
|
|
|
|
|
2025-06-21 12:54:52 +08:00
|
|
|
|
const _tabbar = {
|
|
|
|
|
color: '#999999',
|
|
|
|
|
selectedColor: '#018d71',
|
|
|
|
|
backgroundColor: '#F8F8F8',
|
|
|
|
|
borderStyle: 'black',
|
|
|
|
|
height: '50px',
|
|
|
|
|
fontSize: '10px',
|
|
|
|
|
iconWidth: '24px',
|
|
|
|
|
spacing: '3px',
|
2025-06-21 14:13:30 +08:00
|
|
|
|
list: tabbarList,
|
2025-06-21 12:54:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-06-21 14:13:30 +08:00
|
|
|
|
// 0和1 需要显示底部的tabbar的各种配置,以利用缓存
|
|
|
|
|
export const tabBar = cacheTabbarEnable ? _tabbar : undefined
|