## 项目结构 ~~~ └─ empty-folder/ ·································· 项目所在目录 ├─ pages/ ······································ 页面目录 │ ├─ index/ ··································· index页面 │ │ ├─ index.js ······························ index页面逻辑 │ │ ├─ index.wxml ···························· index页面结构 │ │ └─ index.wxss ···························· index页面样式 │ └─ logs/ ···································· logs页面 │ ├─ logs.js ······························· logs页面逻辑 │ ├─ logs.wxml ····························· logs页面结构 │ └─ logs.wxss ····························· logs页面样式 ├─ utils/ ······································ 公共脚本目录 │ └─ util.js ·································· 工具脚本 ├─ app.js ······································ 应用程序逻辑 ├─ app.json ···································· 应用程序配置 └─ app.wxss ···································· 应用程序公共样式 ~~~ 我简单的画了一个结构图: ![小程序架构](./img/structure.png) ## 页面结构 ## 每个页面组件也分为四个文件组成: ### [page-name].js 页面逻辑文件,用于创建页面对象,以及处理页面生命周期控制和数据处理 ### [page-name].json 设置当前页面工作时的window的配置,此处会覆盖app.json中的window设置,也就是说只可以设置window中设置的属性 ### [page-name].wxml > wxml指的是Wei Xin Markup Language 用于定义页面中元素结构的,语法遵循XML语法,注意是XML语法,不是HTML语法,不是HTML语法,不是HTML语法 ### [page-name].wxss > wxml指的是Wei Xin Style Sheet 用于定义页面样式的,语法遵循CSS语法,扩展了CSS基本用法和长度单位(主要就是rpx响应式像素)