作者:big覀bang-5201314 | 来源:互联网 | 2023-10-15 12:01
在进行微信小程序开发的时候我们会经常遇到底部tab栏的操作,微信小程序官方也为我们提供了简单便捷的配置方法,举例出来供大家参考:在全局的app.json页面中增加tabbar键值对
在进行微信小程序开发的时候我们会经常遇到底部tab栏的操作,微信小程序官方也为我们提供了简单便捷的配置方法,举例出来供大家参考:
在全局的app.json页面中增加tabbar键值对:
代码如下:
{
"pages":[
"pages/index/index",
"pages/cart/cart",
"pages/user/user"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#F58233",
"navigationBarTitleText": "家居电商",
"navigationBarTextStyle":"white"
},
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": "推荐",
"iconPath": "/images/No-orders.png",
"selectedIconPath": "/images/fail.png"
},{
"pagePath": "pages/cart/cart",
"text": "购物车",
"iconPath": "/images/[email protected]",
"selectedIconPath": "/images/[email protected]"
},{
"pagePath": "pages/user/user",
"text": "我",
"iconPath": "/images/defaultAvatar.png",
"selectedIconPath": "/images/[email protected]"
}]
}
}
简单的分享就到这里,如有疑问,欢迎留言~