效果

微信小程序TabBar定义和配置

 

配置

在app.json中加入tabBar配置节点:

"tabBar":{
    "selectedColor":"#1296db",
    "list":[{
      "pagePath":"pages/index/index",
      "text":"首页",
      "iconPath":"images/home.png",
      "selectedIconPath":"images/selected-home.png"
    }, {
      "pagePath":"pages/index/index",
      "text":"分类",
      "iconPath":"images/category.png",
      "selectedIconPath":"images/selected-category.png"
    }, {
      "pagePath":"pages/index/index",
      "text":"我的",
      "iconPath":"images/my.png",
      "selectedIconPath":"images/selected-my.png"
    }]
  },

  

注意:

  • 小程序上给出的文档要求里面的item最少2个,最多五个;
  • 跳转到带有tab的页面使用switchTab,不能跳转到不带tab的页面;

  • 跳转不带tab的页面用redirectTo或者navigateTo;

  • 图标可以到https://www.iconfont.cn/上面去淘淘。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-11-03
  • 2021-05-26
猜你喜欢
  • 2021-07-21
  • 2021-08-10
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
相关资源
相似解决方案