Recently in the micro-letter program, the guests summed up some introductory experience, hoping to help students who want to learn the small program to provide reference
One, micro-letter Small program file structure:
▸pages/: A paging file, a small program consists of a page (analogous to the activity or the pages component inside the Reactjs) ▸utils/: Put some tool methods
. App.js: Small program startup, analogous to Android application class or Mainactivity
App.json: The global configuration file of the applet, which is analogous to the Android manifest file, declares which page the applet has.
APP.WXSS: A global CSS style file
Project.config.json: project configuration file, definition of project name, Base library version, AppID, etc.
Small program consists of a page, analogous to the activity of Android, and other components of the same life cycle, in addition, small program development and Reactjs very much like, such as react inside the use of state management interface data, small program has a almost identical to this, Called Data.
|Onlaunch||Function||Life cycle function – Listener applet initialization||When the applet initialization is complete, onlaunch is triggered (the global trigger only once).|
|OnShow||Function||Life cycle Functions – Monitor applet display||OnShow is triggered when the applet is started or the foreground is displayed from the background|
|Onhide||Function||Life cycle functions – monitoring applet hiding||When the applet enters the background from the foreground, it triggers onhide|
|OnError||Function||Error listener function||When a script error occurs in the applet, or if the API call fails, OnError is triggered and the error message is brought|
Second, learning materials
- Micro-Letter Applet Development Resources Summary: Https://github.com/justjavac/awesome-wechat-weapp
- Weui, WeChat official Library of components: Https://github.com/Tencent/weui
31 Point Idea
- Personal identity can apply for registration of small programs, permissions or a lot of, in addition to payment, real-time video, other basic support
- Micro-Letter Small program to solve us I do not want to install too many apps pain point, the future is very optimistic, recently WeChat launched a small program ads, want to become the grasp of the
- Although the small program was released soon, but now regardless of the official or community of WeChat small program ecology is very friendly, for example, in addition to the official provided a good IDE, other Ides such as Vscode/intellij have plug-in for small programs to support At the same time, it's hot in the community. Develop UI libraries and development frameworks for small programs (such as Mpvue that support Vue)
This article has been in the copyright printing record, protected by copyright law, without permission shall not be reproduced!If you think this article is useful for you, you can click on the "sponsor author" below to hit the author!
Reprint Annotated Original source:Baiyuan's Blog> >https://wangbaiyuan.cn/en/start-up-of-wechat-mini-program-2.html