微信小程序開發(fā)之tabbar圖標(biāo)和顏色的實現(xiàn)
前期準(zhǔn)備 :注冊,填材料,驗證等等:https://mp.weixin.qq.com
1.瀏覽一遍簡易教程,下載相應(yīng)的開發(fā)工具
寫一個小例子
點擊左側(cè)的 “編輯”-》點擊右側(cè)代碼里的 app.json 修改為
{
"pages":[
"pages/fightings/home",
"pages/publish/home",
"pages/mine/home"
],
"tabBar": {
"list": [
{
"pagePath": "pages/fightings/home",
"text": "挑戰(zhàn)"
},
{
"pagePath": "pages/publish/home",
"text": "發(fā)布"
},
{
"pagePath": "pages/mine/home",
"text": "我"
}
]
},
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "i挑戰(zhàn)",
"navigationBarTextStyle":"black"
}
}
說明
- pages就是我們有多少個頁面
- tabbar是頁面底部的tab
- window是頁面的一些屬性

這個樣子太丑了 我們先來美化一下這個tab
{
"pages":[
"pages/home/home",
"pages/fightings/home",
"pages/mine/home"
],
"tabBar": {
"color":"#666666",
"selectedColor":"#f10b2e",
"list": [
{
"pagePath": "pages/home/home",
"text": "大廳",
"iconPath": "./res/icon_tab_home.png",
"selectedIconPath": "./res/icon_tab_home_hl.png"
},
{
"pagePath": "pages/fightings/home",
"text": "挑戰(zhàn)",
"iconPath":"./res/icon_tab_fighting.png",
"selectedIconPath":"./res/icon_tab_fighting_hl.png"
},
{
"pagePath": "pages/mine/home",
"text": "我",
"iconPath": "./res/icon_tab_me.png",
"selectedIconPath": "./res/icon_tab_me_hl.png"
}
]
},
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "i挑戰(zhàn)",
"navigationBarTextStyle":"black"
}
}
說明
字段都比較簡單就不詳細(xì)說了 其中 “iconPath”: “./res/icon_tab_me.png”是圖片的路徑
自己在項目里創(chuàng)建一個res文件夾,然后放入需要的圖片
tab 好看一點了吧

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
javascript實現(xiàn)仿百度圖片的瀑布流加載效果
這是一款仿照百度圖片的瀑布流效果,可以無限加載,兼容各大主流瀏覽器,這里分享給大家,希望小伙伴們能夠喜歡2016-04-04
javascript驗證內(nèi)容為數(shù)字以及長度為10的簡單實例
下面小編就為大家?guī)硪黄猨avascript驗證內(nèi)容為數(shù)字以及長度為10的簡單實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-08-08
淺析js設(shè)置控件的readonly與enabled屬性問題
本篇文章是對js設(shè)置控件的readonly與enabled屬性問題進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助2013-12-12

