├── app.js 全局邏輯
├── app.json 全局配置
├── app.wxss 全局樣式(用處不大尝胆,可以刪掉)
├── project.config.json IDE配置(自動(dòng)生成护桦,不用理會(huì))
│
├── pages 頁面
│ └── index
│ ├── index.json 頁面配置
│ ├── index.wxml 頁面結(jié)構(gòu)
│ ├── index.wxss 頁面樣式表
│ └── index.js 頁面邏輯
│
├── asset 靜態(tài)資源
│
└── utils 工具包
└── utils.js
- app.json小程序全局配置 ,設(shè)置窗口樣式二庵,菜單贪染,網(wǎng)絡(luò)延遲杭隙,下拉刷新等選項(xiàng)。
{
"pages": [
"pages/index/index",
"pages/logs/logs"
],
"window": {
"navigationBarTitleText": "Demo",
"backgroundColor":"#666",
"backgroundTextStyle":"dark",
"enablePullDownRefresh":true,
"onReachBottomDistance":"50"
},
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"text": "首頁"
},
{
"pagePath": "pages/logs/logs",
"text": "日志"
}
]
},
"networkTimeout": {
"request": 10000,
"downloadFile": 10000
},
"debug": true
}
- app.js程序入口文件 痰憎,可以編輯和定義攀涵,程序生命周期中的鉤子函數(shù),也可自定義函數(shù)和屬性以故。
App({
onLaunch: function(options) {
console.log("程序初始化");
},
onShow: function(options) {
console.log("程序界面已顯示");
},
onHide: function() {
console.log("程序界面被隱藏")
},
onError: function(msg) {
console.log("運(yùn)行時(shí)發(fā)生了錯(cuò)誤")
},
onPageNotFound: function(res) {
console.log("跳轉(zhuǎn)頁面不存在404")
},
getName: function() {
console.log("自定義函數(shù)")
},
globalData: 'I am global data'
})
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者