生活随笔
收集整理的這篇文章主要介紹了
微信小程序学习日记day1
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
全局文件的設置
1.新增一個頁面
當你想新建一個頁面時,直接在app.json中加入page字段值,如圖,保存后,系統自動創建一個頁面
2.主界面設置
將主界面文件在app.json中page值放在最前面即可。
3.Window字段常用屬性
navigationBarBackgroundColor:頂部導航欄顏色設置
navigationBarTitleText:標題名稱
navigationBarTextStyle:“white” 標題字的顏色,只有黑色白色兩種顏色
enablePullDownRefresh:true 下拉刷新,將backgroundTextStyle改為dark可以看到刷新時:
? backgroundTextStyle:下拉字體顏色
“backgroundColor”: “#0094ff” 下拉時下拉小塊背景變色
4.tabbar字段:底部導航欄
"tabBar": {"list": [{"pagePath": "pagePath","text": "text","iconPath": "iconPath","selectedIconPath": "selectedIconPath"}] },
pagePath:跳轉到的頁面路徑。和pages的路徑一樣text:名稱iconPath:未激活的按鈕圖標路徑:圖片路徑就是文件夾名/圖片名selectedIconPath:被選中的按鈕圖標路徑
注意:
至少需要兩項才能形成導航欄
依次建立導航欄如圖所示
更改底部文字默認顏色和被選中時的顏色
注意:
tabBar其他屬性是和list屬性同級,不要放錯
常用屬性:
“color”: “#0094ff” , 默認字體顏色
“selectedColor”: “#ff9400”, 被選中后字體顏色
“backgroundColor”: “#ff5533”, 背景顏色
“position”: “bottom” 按鈕在底部,在頂部隱藏圖標
{"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": "我的應用","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"
}
總結
以上是生活随笔為你收集整理的微信小程序学习日记day1的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。