微信小程序 - 自定義tabbar(組件)


 

 

 

 

 

配置項(關於使用組件)

 

 

index.wxml

<!-- 
  tabBar:tabBar配置
  activeIndex: 激活頁面下標
  slots: 多插槽配置(需與頁面一致)
-->

<tabbar data="{{tabBar}}" activeIndex="0" solts="{{solts}}">
  <view slot="index">index1...</view>
  <view slot="other">other2...</view>
  <view slot="my">my3....</view>
  <view slot="hello">hello...4</view>
  <view slot="bat">bat...5</view>
</tabbar>

 

 

index.js(data

  tabBar: {
      "selectedColor": "#5DBCFF",
      "normalColor": "#333",
      "backgroundColor": "#fff",
      "selectedBackgroundColor": "#fff",
      "list": [{
        "pagePath": "market/index/index",
        "iconPath": "images/icon_home.png",
        "selectedIconPath": "images/icon_home_selected.png",
        "text": "首頁"
      }, {
        "pagePath": "tools/index/index",
        "iconPath": "images/icon_cate.png",
        "selectedIconPath": "images/icon_cate_selected.png",
        "text": "分類"
      }, {
        "pagePath": "viewing/index/index",
        "iconPath": "images/icon_member.png",
        "selectedIconPath": "images/icon_member_selected.png",
        "text": "我"
      }, {
        "pagePath": "viewing/index/index",
        "iconPath": "images/icon_member.png",
        "selectedIconPath": "images/icon_member_selected.png",
        "text": "Hello"
      }, {
        "pagePath": "viewing/index/index",
        "iconPath": "images/icon_member.png",
        "selectedIconPath": "images/icon_member_selected.png",
        "text": "Bat"
      }]
    },
    solts: [{
      name: 'index'
    }, {
      name: 'other'
    }, {
      name: 'my'
    }, {
      name: 'hello'
    }, {
      name: 'bat'
    }]

  

 

示例:點擊下載


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM