refactor(tabbar): 将tabbar配置抽离为单独模块以提高可维护性

将pages.config.ts中的tabbar配置抽离到单独的tabbarList.ts文件
移除pages.json中无用的__esModule字段
This commit is contained in:
feige996 2025-06-20 19:32:34 +08:00
parent fe751745e5
commit 9a34868fb7
3 changed files with 29 additions and 28 deletions

View File

@ -1,4 +1,5 @@
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages' import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
import tabbarList from './src/components/fg-tabbar/tabbarList'
export default defineUniPages({ export default defineUniPages({
globalStyle: { globalStyle: {
@ -28,32 +29,6 @@ export default defineUniPages({
fontSize: '10px', fontSize: '10px',
iconWidth: '24px', iconWidth: '24px',
spacing: '3px', spacing: '3px',
list: [ list: tabbarList as any,
// 注意tabbar路由需要使用 layout:tabbar 布局
{
pagePath: 'pages/index/index',
text: '首页',
icon: 'home',
iconType: 'wot',
},
{
pagePath: 'pages/about/about',
text: '关于',
icon: 'i-carbon-code',
iconType: 'unocss',
},
// {
// pagePath: 'pages/my/index',
// text: '我的',
// icon: '/static/logo.svg',
// iconType: 'local',
// },
// {
// pagePath: 'pages/mine/index',
// text: '我的',
// icon: 'iconfont icon-my',
// iconType: 'iconfont',
// },
],
}, },
}) })

View File

@ -0,0 +1,27 @@
export default [
// 注意tabbar路由需要使用 layout:tabbar 布局
{
pagePath: 'pages/index/index',
text: '首页',
icon: 'home',
iconType: 'wot',
},
{
pagePath: 'pages/about/about',
text: '关于',
icon: 'i-carbon-code',
iconType: 'unocss',
},
// {
// pagePath: 'pages/my/index',
// text: '我的',
// icon: '/static/logo.svg',
// iconType: 'local',
// },
// {
// pagePath: 'pages/mine/index',
// text: '我的',
// icon: 'iconfont icon-my',
// iconType: 'iconfont',
// },
]

View File

@ -39,7 +39,6 @@
} }
] ]
}, },
"__esModule": true,
"pages": [ "pages": [
{ {
"path": "pages/index/index", "path": "pages/index/index",