前言:
小程序的配置app.json 相當?shù)闹匾?,這里說一說他的各種配置代表的參數(shù)
官網(wǎng)配置入口
我自己的app.json代碼:
{"pages": ["pages/index","pages/Play/play","pages/my/my","pages/search/search","pages/trump/trump"],"window": {"navigationBarBackgroundColor": "#2b2e33","navigationBarTextStyle": "white","navigationBarTitleText": "芒果TV","backgroundColor": "#fff","backgroundTextStyle": "light"},"tabBar": {"color": "#74777e","selectedColor": "#f06000","borderStyle": "white","backgroundColor": "#fff","list": [{"pagePath": "pages/index","iconPath": "image/jx.png","selectedIconPath": "image/jxselect.png","text": "精選"},{"pagePath": "pages/search/search","iconPath": "image/ss.png","selectedIconPath": "image/ssselect.png","text": "搜索"},{"pagePath": "pages/trump/trump","iconPath": "image/wp.png","selectedIconPath": "image/wpselect.png","text": "王牌強檔"},{"pagePath": "pages/my/my","iconPath": "image/my.png","selectedIconPath": "image/myselect.png","text": "我的"}]},"networkTimeout": {"request": 10000,"connectSocket": 10000,"uploadFile": 10000,"downloadFile": 10000},"debug": true,"sitemapLocation": "sitemap.json"
}
配置詳解:
1、pages 這里配置的是你的頁面,所有的pages下面的頁面都得配置才能調用,不配置會報錯,并且頁面出不來
"pages": ["pages/index","pages/Play/play","pages/my/my","pages/search/search","pages/trump/trump"],
2、window 用于設置小程序的狀態(tài)欄、導航條、標題、窗口背景色。
"window": {"navigationBarBackgroundColor": "#2b2e33",//導航欄背景圖顏色"navigationBarTextStyle": "white",//導航欄標題顏色 white/black"navigationBarTitleText": "芒果TV",//導航欄中間的文字"backgroundColor": "#fff", //窗口背景色"backgroundTextStyle": "light"},
3、分包-來寫路由,這樣可以將小程序的上限變成8m
"tabBar": {"color": "#74777e","selectedColor": "#f06000","borderStyle": "white","backgroundColor": "#fff","list": [{"pagePath": "pages/index","iconPath": "image/jx.png","selectedIconPath": "image/jxselect.png","text": "精選"},{"pagePath": "pages/search/search","iconPath": "image/ss.png","selectedIconPath": "image/ssselect.png","text": "搜索"},{"pagePath": "pages/trump/trump","iconPath": "image/wp.png","selectedIconPath": "image/wpselect.png","text": "王牌強檔"},{"pagePath": "pages/my/my","iconPath": "image/my.png","selectedIconPath": "image/myselect.png","text": "我的"}]},
說了這么多,也就是底部導航欄
4、networkTimeout
5、debug
6、sitemapLocation
小程序根目錄下的 sitemap.json
文件用于配置小程序及其頁面是否允許被微信索引,文件內容為一個 JSON 對象,如果沒有 sitemap.json
,則默認為所有頁面都允許被索引;