效果
配置
在app.json中加入tabBar配置節點:
"tabBar":{ "selectedColor":"#1296db", "list":[{ "pagePath":"pages/index/index", "text":"首頁", "iconPath":"images/home.png", "selectedIconPath":"images/selected-home.png" }, { "pagePath":"pages/index/index", "text":"分類", "iconPath":"images/category.png", "selectedIconPath":"images/selected-category.png" }, { "pagePath":"pages/index/index", "text":"我的", "iconPath":"images/my.png", "selectedIconPath":"images/selected-my.png" }] },
注意:
- 小程序上給出的文檔要求里面的item最少2個,最多五個;
-
跳轉到帶有tab的頁面使用switchTab,不能跳轉到不帶tab的頁面;
-
跳轉不帶tab的頁面用redirectTo或者navigateTo;
- 圖標可以到https://www.iconfont.cn/上面去淘淘。