小程序

微信小程序之tabBar(官方原生与官方自定义)

2020-03-24  本文已影响0人  兮木兮木
官方原生tabBar
  1. 需要在app.json配置以下tabBar选项

    "tabBar": {
        "color": "#ff0000", //颜色
        "selectedColor": "#ffff00",  //选中时的颜色
        "backgroundColor": "#1697eb",  //tab背景色
        "borderStyle": "black",  //tabBar盒子上面的border颜色,只支持black 与 white
        "list": [
          {
            "pagePath": "pages/tabOne/tabOne", //此处路径要写不带 ‘/’的
            "text": "1号",            //tab名字
            "iconPath": "image/icon_API.png",  //tab图标
            "selectedIconPath": "image/icon_API_HL.png" //选中时的tab图标
          },
          {
            "pagePath": "pages/tabTwo/tabTwo",
            "text": "2号",
            "iconPath": "image/icon_API.png",
            "selectedIconPath": "image/icon_API_HL.png"
          },
          {
            "pagePath": "pages/tabThree/tabThree",
            "text": "3号",
            "iconPath": "image/icon_API.png",
            "selectedIconPath": "image/icon_API_HL.png"
          },
          {
            "pagePath": "pages/tabFour/tabFour",
            "text": "4号",
            "iconPath": "image/icon_API.png",
            "selectedIconPath": "image/icon_API_HL.png"
          },
          {
            "pagePath": "pages/tabFive/tabFive",
            "text": "5号",
            "iconPath": "image/icon_API.png",
            "selectedIconPath": "image/icon_API_HL.png"
          }
        ],
        "position": "bottom",  //tabBar的位置 top 或 bottom
        "custom": false  //自定义tabBar时为true
      }
    
官方自定义tabBar
上一篇下一篇

猜你喜欢

热点阅读