微信小程序—tabBar底部導航中文註解api

微信小程序tabBar底部導航中文註解api,信小程序tabBar就是app底部的那個導航欄,能夠放1-5導航連接,這裏對微信小程序底部導航tabbar的中文解釋。
微信小程序tabBar是在全局app.json文件裏面配置的。json

 小程序tabBar配置代碼註解

{
    "pages":[
        "pages/index/index",
        "pages/detail/detail"
    ],
    "window":{
        "navigationBarTitleText": "TabBar",
        "navigationBarBackgroundColor": "#F60",
        "navigationBarTextStyle": "white"
    },

    //tabBar注意是B是大寫,有朋友提問運行時tab沒出現,檢查是否是這裏手誤
    "tabBar":{

    //文檔指出color是必填項,其實可爲空,不重寫color就是深灰,樣式更統一
        "color": "#ddd",

   //一樣,文檔指出selectedColor是必填項,不過selectedColor有必要重寫,區分當前項與普通項
        "selectedColor": "#3cc51f",

   //一樣,文檔指出color是必填項,其實可爲空,不重寫backgroundColor就是淺灰,樣式更統一。
        "backgroundColor": "#fff",

   //borderStyle,不寫默認就是黑,那就黑好了,white的話,會少一條分隔線,跟頁面混在一塊兒了
        "borderStyle":"black",
        "list":[{
                "pagePath":"pages/index/index",

   //iconPath圖標是非必填,只是tab欄會變矮,天然selectedIconPath也可不寫
                "iconPath":"image/icon_API.png",
                "selectedIconPath":"image/icon_API_HL.png",
                "text":"index"
            },{
                "pagePath":"pages/detail/detail",
                "iconPath":"image/icon_component.png",
                "selectedIconPath":"image/icon_component_HL.png",
                "text":"detail"
            }]
    }
}

 小程序tabBar參數說明

若是咱們的小程序是一個多 tab 應用(客戶端窗口的底部有tab欄能夠切換頁面),那麼咱們能夠經過 tabBar 配置項指定 tab 欄的表現,以及 tab 切換時顯示的對應頁面。小程序

tabBar 是一個數組,只能配置最少2個、最多5個 tab,tab 按數組的順序排序。微信小程序

屬性說明:api

屬性 類型 必填 默認值 描述
color HexColor   tab 上的文字默認顏色
selectedColor HexColor   tab 上的文字選中時的顏色
backgroundColor HexColor   tab 的背景色
borderStyle String black tabbar上邊框的顏色, 僅支持 black/white
list Array   tab 的列表,詳見 list 屬性說明,最少2個、最多5個 tab
position String bottom 可選值 bottom、top

其中 list 接受一個數組,數組中的每一個項都是一個對象,其屬性值以下:數組

屬性 類型 必填 說明
pagePath String 頁面路徑,必須在 pages 中先定義
text String tab 上按鈕文字
iconPath String 圖片路徑,icon 大小限制爲40kb
selectedIconPath String 選中時的圖片路徑,icon 大小限制爲40kb

微信小程序tabBar底部導航中文註解api

相關文章
相關標籤/搜索