Introduction to applets
Applets are a new way to connect users and services , It can be easily obtained and spread in wechat , At the same time, it has an excellent use experience .
The difference between small program and common web development
The main development language for applets is JavaScript , The development of small programs has a lot of similarities with the development of ordinary web pages . For front-end developers , The cost of moving from web development to applet development is not high , But there are still some differences between them .
Web development rendering thread and script thread are mutually exclusive , That's why a long run of scripts can cause pages to become unresponsive , And in applets , The two are separate , Running in different threads . Web developers can use a variety of browsers exposed DOM API, Conduct DOM Select and operate . And as mentioned above , The logic layer and rendering layer of the applet are separate , The logic layer runs in JSCore in , There is no complete browser object , So there is a lack of relevant DOM API and BOM API. This difference leads to some libraries that are very familiar with front-end development , for example jQuery、 Zepto etc. , It doesn't work in small programs . meanwhile JSCore The environment is the same as NodeJS The environment is also different , So some NPM The package is also not able to run in the applet .
Web developers need to face the environment is a variety of browsers ,PC The end needs to face IE、Chrome、QQ The browser etc. , On the mobile end, we have to face Safari、Chrome as well as iOS、Android All kinds of things in the system WebView . The small program development process needs to face two big operating systems iOS and Android Wechat client of , And small program developer tools for assisting development , Small procedures in the three major operating environment is also different .
The environment in which the applet runs
When web developers develop web pages , Just use the browser , And with some auxiliary tools or editors . The development of small programs is different , Need to apply for a small program account 、 Install the applet developer tool 、 Configuration items and so on .
Install wechat developer tools
Installation address
https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
Download the corresponding installation package according to your own operating system to install
Registered account
The first step in developing a small program , You need to have an app account , Through this account, you can manage your applet .
Click to enter
Then click the applet and click
Go to register
Fill in the information and submit the corresponding information according to the guidelines , You can have your own applet account .
Open wechat developer tool and log in with wechat scanning code
Create wechat applet
Choose whether to use cloud services for back-end services , Template selection JavaScript Templates , These are selected according to your own needs
AppID land
Click development management > Development setting handle appid Copied from wechat developer tool appid
The first small program is built
原网站版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207061948275551.html