微信小程序——底部导航栏tabBar

微信小程序中的底部导航栏使用tabBar来实现,先来张效果图:

小程序上给出的文档要求里面的item最少2个,最多五个。

这个需要在app.json文件里来配置。

 

具体的配置内容如下:

"tabBar":{
    "position":"bottom",
    "color":"#333333",
    "selectedColor":"#2487FF",
    "list":[
      {
        "pagePath":"pages/home/home",
        "text":"首页",
        "iconPath":"images/bottom_home_normal.png",
        "selectedIconPath":"images/bottom_home_press.png"
      },
      {
        "pagePath": "pages/warning/warning",
        "text": "预警",
        "iconPath": "images/bottom_police_normal.png",
        "selectedIconPath": "images/bottom_police_press.png"
      },
      {
        "pagePath": "pages/im/room/room",
        "text": "授权",
        "iconPath": "images/bottom_permission_normal.png",
        "selectedIconPath": "images/bottom_permission_press.png"
      },
      {
        "pagePath": "pages/mine/mine",
        "text":"我的",
        "iconPath": "images/bottom_mine_normal.png",
        "selectedIconPath": "images/bottom_mine_press.png"
      }
    ]
  },

 各属性的意思:

tabBar:底部导航栏配置属性;

position:bottom设置在底部显示;

color:未选中时文字的颜色;

selectedColor:选中时文字的颜色;

list:导航栏item配置属性;

pagePath:点击后 显示的页面;

text:tabBar项的标题(导航栏图标下面的文字);

iconPath:导航栏item未选择时默认显示的图标;

selectedIconPath:导航栏item选中时显示的图标。

官方文档地址:https://developers.weixin.qq.com/miniprogram/dev/extended/weui/tabbar.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

时代新人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值