在进行微信小程序开发的时候我们会经常遇到底部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/face2@2x.png",
"selectedIconPath": "/images/Occupy@2x.png"
},{
"pagePath": "pages/user/user",
"text": "我",
"iconPath": "/images/defaultAvatar.png",
"selectedIconPath": "/images/Repair@2x.png"
}]
}
}
【微信小程序-底部导航tabbar】简单的分享就到这里,如有疑问,欢迎留言~
推荐阅读
- 计算机网络|【计算机网络】TCP和UDP的特点及区别
- 实用工具|10种舒服的颜色及配色推荐
- java|SpringMVC-核心组件
- 前端|前端食堂技术周刊第 44 期(Bun、Vue.js 挑战、React 状态管理的新浪潮、Can I DevTools、函数式编程)
- 前端|越来越快的jsRuntime——Bun
- webpack|webpack基础(8).代码分离
- Webpack5完整教程|webpack(八)代码分离
- webpack|webpack知识点
- Java|ElasticSearch 7.8.1教程(from b站狂神)+JD商城仿站