目录
小程序配置
全局配置
小程序根目录下的 app.json 文件用来对微信小程序进行全局配置,决定页面文件的路径、窗口表现、设置网络超时时间、设置多 tab 等。
以下是网悦新闻小程序 app.json的具体配置:
{
"pages": [
"pages/news/list/index",
"pages/news/details/index",
"pages/video/list/index",
"pages/video/details/index",
"pages/circle/list/index",
"pages/mine/index/index",
"pages/logs/logs"
],
"tabBar": {
"color": "#666666",
"selectedColor": "#da372b",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/news/list/index",
"text": "首页",
"iconPath": "static/tabBarIco/newsIco.png",
"selectedIconPath": "static/tabBarIco/newsIco_sel.png"
},
{
"pagePath": "pages/video/list/index",
"text": "视频",
"iconPath": "static/tabBarIco/videoIco.png",
"selectedIconPath": "static/tabBarIco/videoIco_sel.png"
},
{
"pagePath": "pages/circle/list/index",
"text": "圈子",
"iconPath": "static/tabBarIco/circleIco.png",
"selectedIconPath": "static/tabBarIco/circleIco_sel.png"
},
{
"pagePath": "pages/mine/index/index",
"text": "我的",
"iconPath": "static/tabBarIco/mineIco.png",
"selectedIconPath": "static/tabBarIco/mineIco_sel.png"
}
]
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#da372b",
"navigationBarTitleText": "网悦阅读精选",
"navigationBarTextStyle": "white"
}
}
页面配置
每一个小程序页面也可以使用同名 .json 文件来对本页面的窗口表现进行配置,页面中配置项会覆盖 app.json 的 window 中相同的配置项。
1、新闻列表的页面配置主要引用了自定义的组件。
{
"usingComponents": {
"myLoading": "/components/myLoading/index",
"myMessageBox": "/components/myMessageBox/index",
"myTabBar": "/components/myTabBar/index"
}
}
2、新闻详情页面配置主要对顶部导航栏的内容和样式进行了调整。
{
"usingComponents": {},
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "",
"navigationBarTextStyle": "black"
}