小程序tabBar底部导航详细介绍

几乎每个app都会用到底部导航的,相对于小程序而言自然也是如此了。小程序的底部导航tabBar写起来相对没有那么复杂。只要在app.json中配置就好了。

注意:tabBar至少两个最多五个item选项

tabBar的主要属性:


tabBar中每个item的属性如下:


当然官网中也有详细说明:


最后是tabBar在app.json中的应用实例:

{
  "pages":[
    "pages/index/index",
    "pages/fans/fans",
    "pages/shopCart/shopCart",
    "pages/mine/mine",
    "pages/logs/logs"
  ],
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#353535",
    "navigationBarTitleText": "小程序",
    "navigationBarTextStyle":"#fff"
  },
  "tabBar": {
    "color": "#666666",
    "selectedColor": "#ff4a4a",
    "borderStyle": "white",
    "backgroundColor": "#ffffff",
    "list": [{
      "pagePath": "pages/index/index",
      "text": "首页",
      "iconPath": "img/home.png",
      "selectedIconPath": "img/home_slt.png"
    },{
      "pagePath": "pages/fans/fans",
      "text": "粉丝",
      "iconPath": "img/fans_merchant.png",
      "selectedIconPath": "img/fans_merchant_slt.png"
    },{
      "pagePath": "pages/shopCart/shopCart",
      "text": "购物车",
      "iconPath": "img/shopping_cart.png",
      "selectedIconPath": "img/shopping_cart_slt.png"
    },{
      "pagePath": "pages/mine/mine",
      "text": "我的",
      "iconPath": "img/mine.png",
      "selectedIconPath": "img/mine_slt.png"
    }]
  }
}

这样就可以运用底部了。O(∩_∩)O

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值