Browse Source

✨ feat(tabbar): 添加底部导航页面

陈雪 3 weeks ago
parent
commit
8c0f2c1bb8

+ 25 - 6
pages.config.ts

@@ -17,6 +17,7 @@ export default defineUniPages({
     },
   },
   tabBar: {
+    custom: true,
     color: '#999999',
     selectedColor: '#018d71',
     backgroundColor: '#F8F8F8',
@@ -27,16 +28,34 @@ export default defineUniPages({
     spacing: '3px',
     list: [
       {
-        iconPath: 'static/tabbar/home.png',
-        selectedIconPath: 'static/tabbar/homeHL.png',
+        icon: '/static/tabbar/home.png',
         pagePath: 'pages/index/index',
         text: '%tabbar.home%',
+        iconType: 'local',
       },
       {
-        iconPath: 'static/tabbar/example.png',
-        selectedIconPath: 'static/tabbar/exampleHL.png',
-        pagePath: 'pages/about/about',
-        text: '%tabbar.about%',
+        icon: '/static/tabbar/category.png',
+        pagePath: 'pages/category/category',
+        text: '%tabbar.category%',
+        iconType: 'local',
+      },
+      {
+        icon: '/static/tabbar/cart.png',
+        pagePath: 'pages/cart/cart',
+        text: '%tabbar.cart%',
+        iconType: 'local',
+      },
+      {
+        icon: '/static/tabbar/community.png',
+        pagePath: 'pages/community/community',
+        text: '%tabbar.community%',
+        iconType: 'local',
+      },
+      {
+        icon: '/static/tabbar/person.png',
+        pagePath: 'pages/person/person',
+        text: '%tabbar.person%',
+        iconType: 'local',
       },
     ],
   },

+ 4 - 1
src/locale/en.json

@@ -1,6 +1,9 @@
 {
   "tabbar.home": "Home",
-  "tabbar.about": "About",
+  "tabbar.category": "Category",
+  "tabbar.cart": "Cart",
+  "tabbar.community": "Community",
+  "tabbar.person": "Person",
   "app.name": "En Title",
   "weight": "{heavy}KG",
   "detail": "{0}cm, {1}KG",

+ 5 - 2
src/locale/zh-Hans.json

@@ -1,6 +1,9 @@
 {
-  "tabbar.home": "首页",
-  "tabbar.about": "关于",
+  "tabbar.home": "主页",
+  "tabbar.category": "分类",
+  "tabbar.cart": "购物车",
+  "tabbar.community": "社区",
+  "tabbar.person": "我的",
   "app.name": "中文标题",
   "weight": "{heavy}公斤",
   "detail": "{0}cm, {1}公斤",

+ 10 - 0
src/pages/cart/cart.vue

@@ -0,0 +1,10 @@
+<route lang="json5">
+{
+  style: {
+    navigationBarTitleText: '%tabbar.cart%',
+  },
+}
+</route>
+<template>
+  <view>购物车</view>
+</template>

+ 10 - 0
src/pages/category/category.vue

@@ -0,0 +1,10 @@
+<route lang="json5">
+{
+  style: {
+    navigationBarTitleText: '%tabbar.category%',
+  },
+}
+</route>
+<template>
+  <view>分类</view>
+</template>

+ 10 - 0
src/pages/community/community.vue

@@ -0,0 +1,10 @@
+<route lang="json5">
+{
+  style: {
+    navigationBarTitleText: '%tabbar.community%',
+  },
+}
+</route>
+<template>
+  <view>社区</view>
+</template>

+ 10 - 0
src/pages/person/person.vue

@@ -0,0 +1,10 @@
+<route lang="json5">
+{
+  style: {
+    navigationBarTitleText: '%tabbar.person%',
+  },
+}
+</route>
+<template>
+  <view>个人中心</view>
+</template>