Bladeren bron

修改tabbar跳转

sunshibo 2 maanden geleden
bovenliggende
commit
cf19e8e6cb
3 gewijzigde bestanden met toevoegingen van 26 en 6 verwijderingen
  1. 2 1
      components/TabBar.vue
  2. 4 5
      manifest.json
  3. 20 0
      pages.json

+ 2 - 1
components/TabBar.vue

@@ -45,9 +45,10 @@ const getTabBarWrapStyle = computed(() => ({
 	position: props.fixed ? 'fixed' : 'relative'
 }));
 
+// 底部 tabBar 跳转(需在 pages.json 中配置 tabBar.list)
 function go(url) {
 	if (url === unref(getPath)) return;
-	uni.reLaunch({ url });
+	uni.switchTab({ url });
 }
 
 const getPath = computed(() => {

+ 4 - 5
manifest.json

@@ -43,21 +43,20 @@
     },
     "quickapp" : {},
     "mp-weixin" : {
-        "plugins" : {
-        },
+        "plugins" : {},
         "appid" : "wxc9598c736783dfa9",
         "setting" : {
             "urlCheck" : false,
             "es6" : true,
-            "minified" : true
+            "minified" : true,
+            "postcss" : true
         },
         "usingComponents" : true,
         "permission" : {
             "scope.userLocation" : {
                 "desc" : "你的位置信息将用于小程序位置接口的效果展示"
             },
-            "scope.record" : {
-            }
+            "scope.record" : {}
         },
         "requiredPrivateInfos" : [ "getLocation" ]
     },

+ 20 - 0
pages.json

@@ -88,5 +88,25 @@
 		},
 		"usingComponents": {},
 		"plugins": {}
+	},
+	"tabBar": {
+		"custom": true,
+		"color": "#999999",
+		"selectedColor": "#333333",
+		"backgroundColor": "#ffffff",
+		"list": [
+			{
+				"pagePath": "pages/index/index",
+				"text": "首页"
+			},
+			{
+				"pagePath": "pages/numberOfDiners/index",
+				"text": "扫码点餐"
+			},
+			{
+				"pagePath": "pages/personal/index",
+				"text": "我的"
+			}
+		]
 	}
 }