微信文件与目录结构
程序主体
- app.js
- app.json 程序配置
- pages 页面路径
- window 页面的窗口表现
- tabBar 底部tab切换
- networkTimeout 超时
- debug
{ "pages": [ "pages/index/index", "pages/logs/logs", "pages/lcf/lcf" ], "window": { "backgroundTextStyle": "light", // 下拉 loading 的样式,仅支持 dark / light "navigationBarBackgroundColor": "#6495ED", // 导航栏背景颜色,如 #000000 "navigationBarTitleText": "LCF", // 导航栏标题文字内容 "navigationBarTextStyle": "#fff", // 导航栏标题颜色,仅支持 black / white "navigationStyle": "", // 导航栏样式,仅支持以下值:default 默认样式 custom 自定义导航栏,只保留右上角胶囊按钮 "backgroundColor": "", // 窗口的背景色 "backgroundColorTop": "", // 顶部窗口的背景色,仅 iOS 支持 "backgroundColorBottom": "", // 底部窗口的背景色,仅 iOS 支持 "enablePullDownRefresh": "", // 是否全局开启下拉刷新。详见 Page.onPullDownRefresh Boolean false "onReachBottomDistance": "" // 页面上拉触底事件触发时距页面底部距离,单位为px。详见 Page.onReachButom }, "tabBar": { "tabBar": { "color": " #fff", // tab 上的文字默认颜色 "backgroundColor": "#6495ED", // tab 的背景色 "selectedColor": "red", // tab 上的文字选中时的颜色 "borderStyle": "black", // tabbar上边框的颜色, 仅支持 black / white "position": "bottom", // tabBar的位置,仅支持 bottom / top "list": [ // tab 的列表,详见 list 属性说明,最少2个、最多5个 tab { "pagePath": "pages/index/index", // 页面路径,必须在 pages 中先定义 "text": "首页", // tab 上按钮文字 "iconPath": "iconPath", // 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。当 postion 为 top 时,不显示 icon。 "selectedIconPath": "selectedIconPath" // 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。当 postion 为 top 时,不显示 icon }, { "pagePath": "pages/logs/logs", "text": "log", "iconPath": "iconPath", "selectedIconPath": "selectedIconPath" }, { "pagePath": "pages/lcf/lcf", "text": "me", "iconPath": "iconPath", "selectedIconPath": "selectedIconPath" } ] } }, "networkTimeout": { "request": 20000, // wx.request 的超时时间,单位毫秒。 "connectSocket": 20000, // wx.connectSocket 的超时时间,单位毫秒。 "uploadFile": 20000, // wx.uploadFile 的超时时间,单位毫秒。 "downloadFile": 20000 // wx.downloadFile 的超时时间,单位毫秒。 }, "debug": true // 是否开启 debug 模式,默认关闭 }
- app.wxss 公共样式
页面文件
- index.js
- index.json 页面配置
- index.wxss 页面样式
- index.wxml 页面结构
项目配置文件
- project.config.json
注册程序与页面
App({ /** * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) */ onLaunch: function () { }, /** * 当小程序启动,或从后台进入前台显示,会触发 onShow */ onShow: function (options) { }, /** * 当小程序从前台进入后台,会触发 onHide */ onHide: function () { }, /** * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息 */ onError: function (msg) { } })