微信小程序-底部导航tabbar

在进行微信小程序开发的时候我们会经常遇到底部tab栏的操作,微信小程序官方也为我们提供了简单便捷的配置方法,举例出来供大家参考:
在全局的app.json页面中增加tabbar键值对:
微信小程序-底部导航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/face2@2x.png",
"selectedIconPath": "/images/Occupy@2x.png"
},{
"pagePath": "pages/user/user",
"text": "我",
"iconPath": "/images/defaultAvatar.png",
"selectedIconPath": "/images/Repair@2x.png"
}]
}
}

【微信小程序-底部导航tabbar】简单的分享就到这里,如有疑问,欢迎留言~

    推荐阅读