微信小程序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