Преглед изворни кода

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

添加发布按钮作为tabbar中间按钮,同时移除不再需要的custom配置
feige996 пре 10 месеци
родитељ
комит
4f67168494
3 измењених фајлова са 16 додато и 5 уклоњено
  1. 4 2
      pages.config.ts
  2. 7 1
      src/components/fg-tabbar/tabbarList.ts
  3. 5 2
      src/pages.json

+ 4 - 2
pages.config.ts

@@ -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,
   },
   },
 })
 })

+ 7 - 1
src/components/fg-tabbar/tabbarList.ts

@@ -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: '发布',
+}

+ 5 - 2
src/pages.json

@@ -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": [
     {
     {