Principles of WeChat Mini Programs

foreword

WeChat applets are developed using three technologies: JavaScript, WXML, and WXSS. Technically speaking, they are similar to existing front-end development, but they are different when digging deeper.


1. Principle

JavaScript: First of all, the JavaScript code runs in the WeChat App, not in the browser, so some H5 technology applications require WeChat App to provide corresponding API support, which limits the application of H5 technology, and its It cannot be called strict H5, it can be called pseudo H5. Similarly, some unique APIs provided by WeChat are not supported by H5 or are not particularly well supported.

WXML: WXML is developed by WeChat itself based on XML syntax, so when developing, only the existing tags provided by WeChat can be used, and HTML tags cannot be used.

WXSS: WXSS has most of the features of CSS, but not all of them are supported, and there is no detailed documentation on which ones are supported and which ones are not supported.

The architecture of WeChat is a data-driven architecture pattern. Its UI and data are separated, and all page updates need to be realized by changing the data.

The applet is divided into two parts webview and appService. Among them, webview is mainly used to display UI, and appService is used to process business logic, data and interface calls. They run in two processes, communicate through the system layer JSBridge, and realize UI rendering. Event processing


requires attention:

1. The applet does not have the concept of restart

2. When the applet enters the background, the client will stay in the running state for a period of time, and will be actively destroyed by WeChat after a certain period of time

3. If you receive more than two memory warnings from the system in a short period of time, the applet will also be destroyed, which is the essential reason why the page will crash once the page memory overflows

After the developer releases the new version in the background, it cannot immediately affect all existing network users, but in the worst case, the new version information will be sent to the users within 24 hours after the release

Every time it is cold started, it will check whether there is an updated version. If a new version is found, it will asynchronously download the new version of the code package and start it with the client's local package at the same time, that is, the new version of the applet needs to wait. Applied after a cold boot

Guess you like

Origin blog.csdn.net/yjnain3066/article/details/127954477