Home  >  Article  >  WeChat Applet  >  How to write code for WeChat mini program development

How to write code for WeChat mini program development

php中世界最好的语言
php中世界最好的语言Original
2018-06-05 10:14:206428browse

Click "Edit" in the left navigation of the developer tools. We can see that this project has been initialized and contains some simple code files. The most critical and essential ones are app.js, app.json, and app.wxss. Among them, the .js suffix is ​​a script file, the .json suffix is ​​a configuration file, and the .wxss suffix is ​​a style sheet file. The WeChat applet will read these files and generate applet instances.

Let’s briefly understand the functions of these three files to facilitate modification and develop your own WeChat applet from scratch.

app.js is the script code of the mini program. We can monitor and process the life cycle functions of the applet and declare global variables in this file. Call the rich API provided by MINA, such as synchronous storage and synchronous reading of local data in this example.

app.json is the global configuration of the entire applet. We can configure which pages the mini program consists of, configure the background color of the mini program's window, configure the navigation bar style, and configure the default title in this file. Note that no comments can be added to this file.

app.wxss is the common style sheet for the entire applet. We can directly use the style rules declared in app.wxss on the class attribute of the page component.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to create a project for WeChat mini program development

WeChat mini program development to obtain basic user information

The above is the detailed content of How to write code for WeChat mini program development. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn