欢迎来到武汉网站建设公司楚通运建站服务网络工作室!
发布时间:2023-02-14 建站行业作者:楚通运
在 pages.json 中提供 tabBar 配置,和pages,globalStyle同级
tabBar 中的 list 是一个数组,只能配置最少2个、最多5个 tab,tab 按数组的顺序排序
当设置 position 为 top 时,将不会显示 icon
"tabBar": {
"color": "#999999",//tab 上的文字默认颜色
"selectedColor": "#9846FF",//tab 上的文字选中时的颜色
"borderStyle": "white",//tabbar 上边框的颜色,可选值 black/white
"backgroundColor": "#ffffff",//tab 的背景色
"list": [{
"pagePath": "pages/index/index",//页面路径,必须在 pages 中先定义
"text": "首页",//tab 上按钮文字,在 App 和 H5 平台为非必填。例如中间可放一个没有文字的+号图标
"iconPath": "./static/img/icon/home_normal.png",//图片路径
"selectedIconPath": "./static/img/icon/home.png",//选中时的图片路径
"width": "10px",
"height": "20px"
},
{
"pagePath": "pages/message/index",
"text": "消息",
"iconPath": "./static/img/icon/message_normal.png",
"selectedIconPath": "./static/img/icon/message.png"
},
{
"pagePath": "pages/goods/index",
"aliasPath": "/goods",
"text": "抢他",
"iconPath": "./static/img/icon/snapUp_normal.png",
"selectedIconPath": "./static/img/icon/snapUp.png"
},
{
"pagePath": "pages/my/index",
"text": "我的",
"iconPath": "./static/img/icon/my_normal.png",
"selectedIconPath": "./static/img/icon/my.png"
}
]
},
上一篇:HbuilderX报错提示:pages.json tabBar[‘list‘][1][‘pagePath‘] “pages/sort/sort“ 需在 pages 数组中的解决方法