From 4f6716849418085814af6ae9b2e4a51da3ffcdbc Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Fri, 20 Jun 2025 21:40:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(tabbar):=20=E6=B7=BB=E5=8A=A0=E4=B8=AD?= =?UTF-8?q?=E9=97=B4=E6=8C=89=E9=92=AE=E5=B9=B6=E7=A7=BB=E9=99=A4=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89tabbar=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加发布按钮作为tabbar中间按钮,同时移除不再需要的custom配置 --- pages.config.ts | 6 ++++-- src/components/fg-tabbar/tabbarList.ts | 8 +++++++- src/pages.json | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pages.config.ts b/pages.config.ts index 8e98f1d..cf79ee0 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -1,5 +1,5 @@ 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({ globalStyle: { @@ -20,7 +20,7 @@ export default defineUniPages({ }, // 如果不需要tabBar,推荐使用 spa 模板。(pnpm create xxx -t spa) tabBar: { - custom: true, + // custom: true, color: '#999999', selectedColor: '#018d71', backgroundColor: '#F8F8F8', @@ -30,5 +30,7 @@ export default defineUniPages({ iconWidth: '24px', spacing: '3px', list: tabbarList as any, + // midButton 仅App和H5支持 + midButton: midButton, }, }) diff --git a/src/components/fg-tabbar/tabbarList.ts b/src/components/fg-tabbar/tabbarList.ts index d4f7b90..9129e33 100644 --- a/src/components/fg-tabbar/tabbarList.ts +++ b/src/components/fg-tabbar/tabbarList.ts @@ -1,4 +1,4 @@ -export default [ +export const tabbarList = [ // 注意tabbar路由需要使用 layout:tabbar 布局 { pagePath: 'pages/index/index', @@ -25,3 +25,9 @@ export default [ // iconType: 'iconfont', // }, ] + +// midButton 仅App和H5支持 +export const midButton = { + iconPath: '/static/logo.svg', + text: '发布', +} diff --git a/src/pages.json b/src/pages.json index a3ceb1c..7bb9c27 100644 --- a/src/pages.json +++ b/src/pages.json @@ -15,7 +15,6 @@ } }, "tabBar": { - "custom": true, "color": "#999999", "selectedColor": "#018d71", "backgroundColor": "#F8F8F8", @@ -37,7 +36,11 @@ "icon": "i-carbon-code", "iconType": "unocss" } - ] + ], + "midButton": { + "iconPath": "/static/logo.svg", + "text": "发布" + } }, "pages": [ {