赞
踩
自定义 tabBar 可以让开发者更加灵活地设置 tabBar 样式,以满足更多个性化的场景,详细的可以参考微信官方文档tabBar
地址
使用流程:
自定义tabBar必须要有2个tab
- "pages/index/index",
- "pages/cart/cart",
- "pages/category/category",
- "pages/my/my"
命令解读:
pagePath:图二的所创建的tab页面
text:文本
iconPtian:你所导入项目的图标地址
selectedIconPath:选中后的图标地址
- "tabBar": {
- "list": [{
- "pagePath": "pages/index/index",
- "text": "首页",
- "iconPath": "/icons/home.png",
- "selectedIconPath": "/icons/home-0.png"
- },
- {
- "pagePath": "pages/cart/cart",
- "text": "购物车",
- "iconPath": "/icons/cart.png",
- "selectedIconPath": "/icons/cart-0.png"
- },
- {
- "pagePath": "pages/category/category",
- "text": "菜单栏",
- "iconPath": "/icons/category.png",
- "selectedIconPath": "/icons/category-0.png"
- },
- {
- "pagePath": "pages/my/my",
- "text": "我的",
- "iconPath": "/icons/my.png",
- "selectedIconPath": "/icons/my-0.png"
- }
- ]}
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
如果想要在默认启动页用tabBar,可以把pagePath设置成app.json-->pages数组中的第一个就可以了。
效果图:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。