This article introduces the architecture of small program development.
I. applet architecture
The structure of each applet is composed of two main parts:Subject + pages.
Similar to many frameworks, the main part is mainly used for core configuration, and each page is mainly used for different business scenarios.
1.1. the subject consists of three files.
1) app. js: small program logic, APP initialization
2) app. json: small program configuration, such as navigation, window, page http request jump, etc.
3) app. wxss: public style configuration
After the configuration of the subject is completed, it is the corresponding business development, that is, the most common page for developers. The small program page design is basically built according to the MVC structure.
The full name of MVC is Model View Controller, short for model-view-controller. it is a Model of software design, organize code by means of separation of business logic, data, and interface display, and integrate the business logic into a component to improve and personalize the custom interface and user interaction, you do not need to rewrite the business logic. MVC is uniquely developed to map traditional input, processing, and output functions in a logical graphical user interface structure.
1.2. the page consists of four files
1) js: Page logic, equivalent to the control layer (C); also includes part of the data (M)
2) wxml: displays the page structure, which is equivalent to the view layer (V)
3) wxss: page style table, pure front-end, used to assist in wxml display
4) json: page configuration, configure the data displayed on some pages, and act as part of the model (M)
Related articles:
Detailed description of small program data access instances
Detailed description of the instance code of the applet label component
Detailed steps of examples of mini-program development tutorials
The above is a detailed illustration of the small program development architecture. For more information, see other related articles in the first PHP community!