微信小程序网悦新闻开发--小程序配置(二)
目录
小程序配置
全局配置
小程序根目录下的 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"
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通