微信小程序tabBar如何设置

tabBar属于全局配置,所以它应该在app.json中进行配置

 

"tabBar": {
    "color": "#ccccc",
    "selectedColor": "#42BD55",
    "backgroundColor": "",
    "position": "bottom",
    "borderStyle": "black",
    "list": [
      {
        "pagePath": "pages/index1/index1",
        "text": "首页",
        "iconPath": "/img/c2.png",
        "selectedIconPath": "/img/w1.png"
      },
       {
        "pagePath": "pages/index2/index2",
        "text": "菜单一",
        "iconPath": "/img/c2.png",
        "selectedIconPath": "/img/w1.png"
      },
      {
        "pagePath": "pages/index3/index3",
        "text": "菜单二",
        "iconPath": "/img/c2.png",
        "selectedIconPath": "/img/w1.png"
      }
    ]
  },

 

各参数的说明:

iconPath:未选中icon样式
selectedIconPath:选中icon样式
pagePath:页面路径
text:菜单标题
 
 


 

posted @ 2021-03-29 22:14  Conqueror·  阅读(692)  评论(0编辑  收藏  举报