app.json

  • 小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。 ```json //app.json 文件

{
//页面路径列表 => 项目中有几个页面,这里就要写几个页面 //=> 新增/减少页面,都需要对 pages 数组进行修改 “pages”: [
“pages/index/index”, //第一项代表小程序的初始页面(首页) “pages/logs/logs”, “pages/history/history” ],

// 用于设置小程序全局的状态栏、导航条、标题、窗口背景色。 “window”: { “backgroundTextStyle”: “light”, // 下拉 loading 的样式 “navigationBarBackgroundColor”: “#64b2f9”, // 导航栏背景颜色

  1. "navigationBarTitleText": "weapp", // 导航栏标题文字内容
  2. "navigationBarTextStyle": "white" //导航栏标题颜色

},

  1. //用于设置底部或顶部有 tab 栏可以切换页面,以及对 tab 栏的配置

“tabBar”: { “color”: “#F8F8FF”, //tab 上的文字默认颜色

  1. "position": "bottom", //tabBar 的位置是顶部还是底部 => 顶部没法设置图标,只有底部才可以
  2. "selectedColor": "#F8F8FF", //tab 上的文字选中时的颜色
  3. "borderStyle": "black", // tabbar 上边框的颜色
  4. "backgroundColor": "#64b2f9", //tab 的背景色
  5. // list 接受一个数组,只能配置最少 2 个、最多 5 个 tab
  6. "list": [
  7. {
  8. "pagePath": "pages/index/index",
  9. //点击后转到的 tab 路径=>必须在pages也要定义这个路径
  10. "text": "翻译",
  11. //tab 上按钮文字
  12. "iconPath": "pages/index/2.png",
  13. //tab没有选中时候的图片路径
  14. "selectedIconPath": "pages/index/1.png" //tab选中时的图片显示
  15. },
  16. {
  17. "pagePath": "pages/history/history",
  18. "text": "生词本",
  19. "iconPath": "pages/index/4.png",
  20. "selectedIconPath": "pages/index/5.png"
  21. }
  22. ]

},

“usingComponents”: { “iconfont”: “/iconfont/iconfont” },

“style”: “v2”, “sitemapLocation”: “sitemap.json” } ```

app.wxss

  • 控制全局的样式