微信小程序之tabBar配置教程 ,如果小程序是一个多 tab 应用(客户端窗口的底部或顶部有 tab 栏可以切换页面),可以通过 tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。
属性说明:
其中 list 接受一个数组,数组中的每个项都是一个对象,其属性值如下:
我项目做了一个简单配置 (app.json文件里), 大家可以参考下:
"tabBar": { "borderStyle": "white", "position": "bottom", "selectedColor": "blue", "list": [ { "pagePath": "pages/home/home", "text": "阅读", "iconPath": "images/icon/yuedu.png", "selectedIconPath": "images/icon/yuedu_hl.png" }, { "pagePath": "pages/music/music", "text": "音乐", "iconPath": "images/icon/dianying.png", "selectedIconPath": "images/icon/dianying_hl.png" }, { "pagePath": "pages/video/video", "text": "电影", "iconPath": "images/icon/dianying.png", "selectedIconPath": "images/icon/dianying_hl.png" } ] }
如图: