生活随笔
收集整理的這篇文章主要介紹了
微信小程序学习日记day1
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
全局文件的設(shè)置
1.新增一個(gè)頁面
當(dāng)你想新建一個(gè)頁面時(shí),直接在app.json中加入page字段值,如圖,保存后,系統(tǒng)自動(dòng)創(chuàng)建一個(gè)頁面
2.主界面設(shè)置
將主界面文件在app.json中page值放在最前面即可。
3.Window字段常用屬性
navigationBarBackgroundColor:頂部導(dǎo)航欄顏色設(shè)置
navigationBarTitleText:標(biāo)題名稱
navigationBarTextStyle:“white” 標(biāo)題字的顏色,只有黑色白色兩種顏色
enablePullDownRefresh:true 下拉刷新,將backgroundTextStyle改為dark可以看到刷新時(shí):
? backgroundTextStyle:下拉字體顏色
“backgroundColor”: “#0094ff” 下拉時(shí)下拉小塊背景變色
4.tabbar字段:底部導(dǎo)航欄
"tabBar": {"list": [{"pagePath": "pagePath","text": "text","iconPath": "iconPath","selectedIconPath": "selectedIconPath"}] },
pagePath:跳轉(zhuǎn)到的頁面路徑。和pages的路徑一樣text:名稱iconPath:未激活的按鈕圖標(biāo)路徑:圖片路徑就是文件夾名/圖片名selectedIconPath:被選中的按鈕圖標(biāo)路徑
注意:
至少需要兩項(xiàng)才能形成導(dǎo)航欄
依次建立導(dǎo)航欄如圖所示
更改底部文字默認(rèn)顏色和被選中時(shí)的顏色
注意:
tabBar其他屬性是和list屬性同級(jí),不要放錯(cuò)
常用屬性:
“color”: “#0094ff” , 默認(rèn)字體顏色
“selectedColor”: “#ff9400”, 被選中后字體顏色
“backgroundColor”: “#ff5533”, 背景顏色
“position”: “bottom” 按鈕在底部,在頂部隱藏圖標(biāo)
{"pages":["pages/index/index","pages/img/img","pages/mine/mine","pages/search/search","pages/demo01/demo01","pages/demo02/demo02","pages/logs/logs"],"window":{"backgroundTextStyle":"dark","navigationBarBackgroundColor": "#0094ff","navigationBarTitleText": "我的應(yīng)用","navigationBarTextStyle":"white","enablePullDownRefresh": true,"backgroundColor": "#0094ff"},"tabBar": {"list": [{"pagePath": "pages/index/index","text": "首頁","iconPath": "icon/_home.png","selectedIconPath": "icon/home.png"},{"pagePath": "pages/img/img","text": "圖片","iconPath": "icon/_img.png","selectedIconPath": "icon/img.png"},{"pagePath": "pages/mine/mine","text": "我的","iconPath": "icon/_my.png","selectedIconPath": "icon/my.png"},{"pagePath": "pages/search/search","text": "搜索","iconPath": "icon/_search.png","selectedIconPath": "icon/search.png"}] ,"color": "#0094ff" ,"selectedColor": "#ff9400","backgroundColor": "#ff5533","position": "bottom"},"style": "v2","sitemapLocation": "sitemap.json"
}
總結(jié)
以上是生活随笔為你收集整理的微信小程序学习日记day1的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。