Before wanted to learn about micro-channel small program, but some time ago in some of the knowledge and learning Java threads, also did not implement this long overdue goal, finally I found a complete video from the Internet to learn the complete development process from scratch now there is a growing idea is to build their own projects, development projects completed set of processes, Xiangnong particularly familiar with, when nothing, what a good idea, they can develop their own project, from today, pay attention to the project the building, independent development! This is followed by a video explaining to do my notes!
A building project
Development of small micro-channel micro-ecology program needs the letter provided to the public micro-channel application platform up an account, get appId, do some preparatory work to develop small programs, the specific site is: https://mp.weixin.qq.com/
1, the new project
Developer tools I use the developer tools provided by the official micro letter, downloaded: Stable Stable Build (1.02.1904090), with them still in very good, ha ha, for the first time, it is good, and perhaps because it is not used other, get to the bar!
(1) create a blank project, there may also be some basic project documents provided by the official, here are some selected files are deleted, leaving only the pages folder and project.config.json, this project configuration file, and then start from scratch and create a new file folder, you need to create a new file and folder as follows:
app.json
Note: This document is a need to write some code, or it will not back a new page module, simply write the following code: {} braces, represents an object,
Official app.json file configuration items Detailed address:
Applet page detailed configuration parameters:
https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/page.html
app.js
Note: This is the initial need to write code, or can not create a page module, simply write the following code: App ()
classic base module
Right in the micro-channel direct attention Developer Tools -> New classic catalog -> New page, then fill in the classic name, the file is automatically created four classic.js, classic.json, classic.wxml, classic.wxss, and Add app.json in the "pages": [ "pages / classic / classic"] code, this represents the second classic classic.wxml page file, which is registered in app.json completed, each new a page module will need to register in this app.json
The following is a module of four files:
classic.js
classic.json
classic.wxml
1 <view class="chunk color1"></view> 2 <view class="chunk color2"></view> 3 <view class="chunk color3"></view>
classic.wxss
Here it is to write the style pages, the equivalent of the front end of the css file
Simple code example:
1 .chunk{ 2 width:100px; 3 height: 100px; 4 } 5 6 .color1{ 7 background-color: blue; 8 } 9 .color2{ 10 background-color: black; 11 } 12 .color3{ 13 background-color: yellow; 14 }
2, the project layout
Applet layout is the layout of flex support, although I do not know what the hell is the layout of flex, but it should be in the form of boostrap fence and the layout is similar to the bar
Telescopic (1) in any direction, left, right, down, up
(2) can be exchanged and rearranged in the order of pattern layer
(3) and the side shaft spindle arranged to facilitate
Space (4) stretch and fill subelements
(5) aligned along the container
Flex layout applications:
Layout (1) of the body element, the maximum container layout setting longitudinally aligned and laterally arranged inner block element