feat(tabbar): 添加中间按钮并移除自定义tabbar配置

添加发布按钮作为tabbar中间按钮,同时移除不再需要的custom配置
This commit is contained in:
feige996 2025-06-20 21:40:52 +08:00
parent bf61c3d1f0
commit 4f67168494
3 changed files with 16 additions and 5 deletions

View File

@ -1,5 +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' import { tabbarList, midButton } from './src/components/fg-tabbar/tabbarList'
export default defineUniPages({ export default defineUniPages({
globalStyle: { globalStyle: {
@ -20,7 +20,7 @@ export default defineUniPages({
}, },
// 如果不需要tabBar推荐使用 spa 模板。pnpm create xxx -t spa // 如果不需要tabBar推荐使用 spa 模板。pnpm create xxx -t spa
tabBar: { tabBar: {
custom: true, // custom: true,
color: '#999999', color: '#999999',
selectedColor: '#018d71', selectedColor: '#018d71',
backgroundColor: '#F8F8F8', backgroundColor: '#F8F8F8',
@ -30,5 +30,7 @@ export default defineUniPages({
iconWidth: '24px', iconWidth: '24px',
spacing: '3px', spacing: '3px',
list: tabbarList as any, list: tabbarList as any,
// midButton 仅App和H5支持
midButton: midButton,
}, },
}) })

View File

@ -1,4 +1,4 @@
export default [ export const tabbarList = [
// 注意tabbar路由需要使用 layout:tabbar 布局 // 注意tabbar路由需要使用 layout:tabbar 布局
{ {
pagePath: 'pages/index/index', pagePath: 'pages/index/index',
@ -25,3 +25,9 @@ export default [
// iconType: 'iconfont', // iconType: 'iconfont',
// }, // },
] ]
// midButton 仅App和H5支持
export const midButton = {
iconPath: '/static/logo.svg',
text: '发布',
}

View File

@ -15,7 +15,6 @@
} }
}, },
"tabBar": { "tabBar": {
"custom": true,
"color": "#999999", "color": "#999999",
"selectedColor": "#018d71", "selectedColor": "#018d71",
"backgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8",
@ -37,7 +36,11 @@
"icon": "i-carbon-code", "icon": "i-carbon-code",
"iconType": "unocss" "iconType": "unocss"
} }
] ],
"midButton": {
"iconPath": "/static/logo.svg",
"text": "发布"
}
}, },
"pages": [ "pages": [
{ {