微信小程序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/上面去淘淘。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM