一、主要结构
1.app.js:小程序逻辑,初始化APP
2.
app.json :小程序配置,比如底部导航(tabBar)、窗口(window)、页面http请求(pages)跳转等
{
"pages": [
"pages/index/index",
"pages/logs/logs",
"pages/setting/setting"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"BackgroundColor": "#f5f5f5",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "gray",
"selectedColor": "#feb200", //选中的颜色
"list": [{
"pagePath": "pages/index/index", //导航链接
"text": "首页", //导航标题
"iconPath": "pages/image/indexBefore.png", //未选中icon图
"selectedIconPath": "pages/image/index.png" //选中icon图
},
{
"pagePath": "pages/index/content",
"text": "发现",
"iconPath": "pages/image/contentBefore.png",
"selectedIconPath": "pages/image/content.png"
},
{
"pagePath": "pages/setting/setting",
"text": "设置",
"iconPath": "pages/image/settingBefore.png",
"selectedIconPath": "pages/image/setting.png"
}]
}
}
3.
app.wxss:公共样式配置
4.页面由4个文件构成
1)js:页面逻辑,相当于控制层(C);也包括部分的数据(M)
2)wxml:页面结构展示,相当于视图层(V)
3)wxss:页面样式表,纯前端,用于辅助wxml展示
4)json:页面配置,配置一些页面展示的数据,充当部分的模型(M)
二、标签
1.view
2.text
3.button
4.label
5.input
6.……还有很多,有机会再补充