This paper mainly explains

What are the advantages of small programs?

Two, learning wechat small program, what is the basis?

Three, how to learn small program?

Basic file types of small program projects

Five, the summary

preface

As an outstanding representative of “micro service” in recent years, wechat small program is widely used. Applets are a new open capability that allows developers to develop applets quickly. Small programs can be easily obtained and spread in wechat, and have excellent use experience.

Said some popular, micro channel small program is micro channel in the very small program (this is no nonsense……) “, we open wechat in our mobile phone, pull down, you can see the list of small programs. For example, “Tencent QQ” this small program, we can use it, receive QQ messages; Re-enter “jump a jump”, “every day chess” these small games, we can use the short leisure time after learning work to play a small game…… So, why micro channel small program can have such a big development? Now let’s talk about my opinion.

The author once found the existence of small program in the operation and maintenance of wechat public number, and then applied for one, trying to develop the first small program of their own. From scratch to the actual development now, although the code is a template, the idea is also very violent, but usually I will accumulate a lot of practical experience related to small programs and do some open source projects based on micro channel small programs, so to sum up the micro channel small program project experience, I think it is my best growth, Also hope to contact this year micro channel small program or want to engage in micro channel small program work to bring some experience and thinking.

What are the advantages of small programs?

1. It hardly takes up the phone’s memory

If your computer is poorly equipped, you’ll have to make a reasonable choice about which software to install. The author once took the computer of the school computer room to do simple experiment, I install a certain number of antivirus software to the computer, then begin to check up at the same time, Trojan scan operation. Experimental conclusion: only two anti-virus software at the same time physical examination, anti-virus operation will cause the crash, mouse and keyboard no response within 2 minutes and the computer can not work normally; Four antivirus software at the same time physical examination, computer probability blue screen.

Why will the computer crash, blue screen? It’s just running out of computer resources. Similarly, if you load your phone with dozens of apps, the effect can be imagined. Wechat mini programs take up almost no system memory, and can give users, especially those with low mobile phones, a good experience.

2, no installation, run out of walk

Recently, with the Novel Coronavirus, most of the country’s students are participating in online education, which will involve many apps at this time. Of course, the commonly used APP, installed in the mobile phone, completely no problem, but what about those not commonly used, not much need? For example, in the university, there is an APP for charging meals, flushing hot water, running, reading news and doing exercises, and asking for leave is also an APP, which may be mandatory by the school. Have you joked about this kind of behavior?

The micro channel small program is established in the micro channel this large platform application, when used to be opened, disappear after use, and can be used at any time, to do the “use to open, run out of go”. Of course, there are other advantages to applets that I won’t cover here.

Read on and you will learn about this

2. Advantages and design ideas of micro channel small program 3. How to learn micro channel small program 4

Two, learning wechat small program, what is the basis?

Before reading this article, it is recommended that you have the basic knowledge of the following. The code that can write small programs may not be able to achieve business requirements and functions well. If you want to achieve logic of different complexity under different project requirements, you must have a sufficient understanding of the basic knowledge of the following. So in this hope that we are familiar with the relevant basic knowledge, a good study.

1, HTML: at least common tags to learn to use, such as button tags, text tags, to know what some tags are used for. 2. CSS: Understand the definition and usage of class and label selectors; Understand common attributes such as height,width, font size, etc. 3, proficient in a programming language: Java /js/c++ can be, here is mainly to be proficient in variable definition, if condition judgment, character array. Others: relative/absolute path, understand JSON format, life cycle function

Three, how to learn small program?

1. In my personal opinion, the fastest way to learn is to practice. According to the official documents, writing several demos is the best way to learn wechat applets. 2. Learn front-end basics, including but not limited to HTML + CSS + JS + JQ. 3. Learn basic syntax of applets, understand basic structure of applets (JS, JSON, WXML, WXSS). 4, actual combat, write projects.

A few points for beginners:

(1) Small program unlike Vue, modify the code after pressing save, the web page will immediately take effect. After each code change, if you want to see the effect, you must recompile or press Ctrl + S to save, and then wait for the emulator to reload the home page before you can see the effect. (2) be good at calling templates or interfaces, avoid large self-programming. If you need to implement a feature, check the official documentation to see if there is a template or library. (3) If the project needs to connect to the database, the server must be purchased before development, real-name authentication and record. The development time of small program is generally less than the server review time (for small projects), and the address requested by the small program must be the registered domain name. (4) Do not use traditional programming ideas to look at small program development, small program unlike Java can be written, some of its functions may not be able to achieve.

Basic file types of small program projects

Development tools first! Sharpening does not mistakenly cut wood workers, to efficient development, must be skilled in the use of development tools (IDE). Let’s first understand the micro channel small program exclusive development tools.

Official website to download address: developers.weixin.qq.com/miniprogram…

The first area is the emulator area, which is a direct display of the effects of our code. Pressing CTRL + S or compile will refresh the emulator area to display our interface.

The second area is the project structure page, a small program body consists of three files, which must be placed in the root directory of the project: JS (small program logic), JSON (small program common configuration), WXSS (small program common style sheet). Each page surface is divided into JS (page logic), JSON (page configuration), WXML (page structure), WXSS (page style sheet) four modules, and the four files describing the page must have the same path and file name.

The third area, where we write code, takes up most of the screen.

The fourth area is the debug area, where small programs can output temporary messages to the console via console.log(), the equivalent of C++ cout<<“hello ZWZ “<<endl; Also the equivalent of Java sySO. This temporary information will be displayed in this area for debugging purposes.

The fifth area is the commonly used function module. Click Edit here, the code area will be automatically saved, and the simulator will reload the interface. Click upload code, it will be sent to the wechat public platform, and then used to publish small programs.

We will focus on the project structure of the second area

The first piece: JSON

As mentioned above, each page surface is divided into JS (page logic), JSON (page configuration), WXML (page structure), WXSS (page style sheet) four modules, so what are the purpose of these pages?

JSON is a page configuration file, which can be configured for the display of the page window. The file content is a JSON object, which involves many attributes.

NavigationBarTitleText, for example, is the title name that appears at the top of the applet.

The configuration items in the current page will override the same configuration items in the total app.json.

Block 2: WXML

WXML is actually HTML, a set of tag language designed by the framework, combined with the basic components, event system, can build the structure of the page.

For example, the most common two-way data binding:

index.wxml

index.js

So, although we write text in WXML interface is not directly, but {{MSG}} can directly read the JS file variable values. At this point, we press CTRL + S (Save, recompile) and we see that the foreground renders Hello ZWZ. This is known as two-way data binding. If you change the JS background from Hello ZWZ to Hi ZWZ, the foreground will say Hi ZWZ, and so on.

Similarly, if it is an array:

In the JS Page Page data, add array variables, as a normal array

Then replace the MSG of the WXML interface with array, and the interface will display as follows:

This article is originally published by CSDN, linked to blog.csdn.net/qq_41464123… , author blog blog.csdn.net/qq_41464123

Block 3: WXSS

WXSS, like CSS, is a style language that describes WXML’s component styles, and WXSS determines how WXML’s components should be displayed. WXSS owns most of the CSS content during actual development. In contrast to CSS, WXSS’s unique RPX unit, which can be adapted to screen width, may be used. The format is shown below, and the elements in WXML are styled using class selectors.

Block 4: JS

This section, of course, is used to store back-end logic code, and we need to know a few common lifecycle functions,

Then there’s the custom method, which is level with onLoad().

For example, let’s define a button in WXML

Next, write the response event in the JS page

So, after we click the button, we trigger the run() method.

Five, the summary

All in all, this paper explains the basic architecture of the micro channel applets project, and how to learn the micro channel applets, as well as the basis for learning the micro channel applets, as well as the basic code of foreground rendering. Recently I have summarized some key points of Java programmers to share with you, I hope to help you, but also save you the time to search for information on the Internet to learn.

Content covers: Java, MyBatis, ZooKeeper, Dubbo, Elasticsearch, Memcached, Redis, MySQL, Spring, SpringBoot, SpringCloud, RabbitMQ, Kafka, Linux and other technology stacks.

Full version of Java learning address: Java backend learning materials integration

— — — — — — — —

Original link: blog.csdn.net/qq_41464123…