nomadro/apps/miniprogram/h5/src/app.config.ts
Eric dc7a46ee0b Make WeChat launch path pages/home/index and document the index redirect.
Keep 20261011 hub visuals on home; index only reLaunches to avoid missing page wxss.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-11 16:03:31 +08:00

185 lines
4.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const tabBar = {
color: '#8b93a7',
selectedColor: '#4ecdc4',
backgroundColor: '#0c0c0f',
borderStyle: 'black',
list: [
{
pagePath: 'pages/home/index',
text: '首页',
iconPath: 'assets/tab/home.png',
selectedIconPath: 'assets/tab/home-active.png',
},
{
pagePath: 'pages/nav/index',
text: '导航',
iconPath: 'assets/tab/nav.png',
selectedIconPath: 'assets/tab/nav-active.png',
},
{
pagePath: 'pages/book/index',
text: '小册',
iconPath: 'assets/tab/book.png',
selectedIconPath: 'assets/tab/book-active.png',
},
{
pagePath: 'pages/community/index',
text: '社群',
iconPath: 'assets/tab/community.png',
selectedIconPath: 'assets/tab/community-active.png',
},
{
pagePath: 'pages/mine/index',
text: '我的',
iconPath: 'assets/tab/mine.png',
selectedIconPath: 'assets/tab/mine-active.png',
},
],
}
/**
* H5 / 微信:默认无原生 tabBar(首页入口卡片跳转)。
* 仅当显式 TARO_APP_TABBAR=1 时才挂五 Tab。
*/
const isH5 =
process.env.TARO_ENV === 'h5' || process.env.TARO_APP_TARGET === 'h5'
const wantTabBar = !isH5 && process.env.TARO_APP_TABBAR === '1'
/** 微信主包必须 ≤1.5MB:首页/我的留主包,其余进分包 */
const weappConfig = {
// 启动页 = home(官方话题/体验码默认路径);UI 与 tag 20261011 的 index 同组件
pages: ['pages/home/index', 'pages/mine/index', 'pages/index/index'],
subPackages: [
{
root: 'pages/nav',
name: 'nav',
pages: ['index'],
},
{
root: 'pages/book',
name: 'book',
pages: ['index'],
},
{
root: 'pages/reader',
name: 'reader',
pages: ['index'],
},
{
root: 'pages/community',
name: 'community',
pages: ['index'],
},
{
root: 'pages/destinations',
name: 'destinations',
pages: ['index'],
},
{
root: 'pages/destination',
name: 'destination',
pages: ['index'],
},
{
root: 'pages/meetups',
name: 'meetups',
pages: ['index'],
},
{
root: 'pages/vip',
name: 'vip',
pages: ['index'],
},
{
root: 'pages/vip-course',
name: 'vip-course',
pages: ['index'],
},
{
root: 'pages/vip-lesson',
name: 'vip-lesson',
pages: ['index'],
},
{
root: 'pages/vip-ebook',
name: 'vip-ebook',
pages: ['index'],
},
{
root: 'pages/vip-store',
name: 'vip-store',
pages: ['index'],
},
{
root: 'pages/vip-store-detail',
name: 'vip-store-detail',
pages: ['index'],
},
{
root: 'pages/vip-store-orders',
name: 'vip-store-orders',
pages: ['index'],
},
{
root: 'pages/vip-memo',
name: 'vip-memo',
pages: ['index'],
},
{
root: 'pages/vip-memo-detail',
name: 'vip-memo-detail',
pages: ['index'],
},
{
root: 'pages/game',
name: 'game',
pages: ['index'],
},
],
preloadRule: {
'pages/home/index': {
network: 'all',
packages: ['book', 'nav'],
},
},
/** 组件按需注入:代码质量扫描必过项 */
lazyCodeLoading: 'requiredComponents' as const,
}
const h5Config = {
pages: [
'pages/home/index',
'pages/index/index',
'pages/nav/index',
'pages/community/index',
'pages/mine/index',
'pages/book/index',
'pages/reader/index',
'pages/destinations/index',
'pages/destination/index',
'pages/meetups/index',
'pages/vip/index',
'pages/vip-course/index',
'pages/vip-lesson/index',
'pages/vip-ebook/index',
'pages/vip-store/index',
'pages/vip-store-detail/index',
'pages/vip-store-orders/index',
'pages/vip-memo/index',
'pages/vip-memo-detail/index',
'pages/game/index',
],
}
export default defineAppConfig({
...(isH5 ? h5Config : weappConfig),
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#0c0c0f',
navigationBarTitleText: 'nomadro',
navigationBarTextStyle: 'white',
backgroundColor: '#0c0c0f',
},
...(wantTabBar ? { tabBar } : {}),
})