This is the fourth day of my participation in the First Challenge 2022

preface

Haven’t written micro channel small program for a long time, review it, if there is a mistake, I hope you friendly point out ~

An overview of the

Wechat public platform refers to a service platform provided by Tencent that provides business services and user management for individuals, enterprises or organizations.

Wechat public platform provides the following account types:

  1. Service number: The ability to manage business services and users for an enterprise or organization, focusing on service-class interactions. For example, 12315, 114T number of group messages: 4 group messages can be sent within 1 month (according to natural month)
  2. Subscription number: for enterprises, media or individuals to provide a new way of information dissemination, focusing on information dissemination. For example, group sending times of CSND and Daqo: Subscribers (authenticated users and non-authenticated users) can send one group message within one day
  3. Applets: A service for businesses, media, or individuals that does not need to be downloaded and used as a “go – and – go” service
  4. Enterprise wechat: a product for the enterprise market, is an independent APP easy to use basic office communication tools, with the most basic and practical functions and services, specially provided for enterprise use OF IM products

The official address of wechat public platform: mp.winxin.qq.com

Wechat applets access process

1. Register as the developer of wechat mini program

2. Fill in the registration information

3. Activate the mailbox

4. Registration of subject information

5. Log in to the applet background and view the AppID

First small program project

1. Download and install wechat applets

Address: developers.weixin.qq.com/miniprogram…

2. Log in to developer tools

3. Create an applet project

Note: the directory name of the small program project is strictly forbidden to appear Chinese, space and other special symbols!! AppID can be viewed in the applet background -> Development -> Development Settings

Micro channel applets file composition

The wechat applets code consists of the following file types:

  • .wxml, template file

  • .wxss, style file

  • .js, script file

  • .json, configuration file

.wxml

WXML is a template file, acting as the HTML role of web development, but in.wxml can not use any HTML tags, can only use the wechat applet dedicated components.

.wxss

.wxss is a style file that acts as CSS for web development, but.wxss extends CSS.

App.wxss, as a global style, applies to all pages of the current applet.

Page. WXSS as a page style, only applies to the current page; When styles collide, page. WXSS overrides app. WXSS

.js

.js is a script file that acts as js (ECMAScript,ES) during web development

App.js is the entrance script file of wechat small program.

Page.js is a script file for a page

.json

Json is the configuration file.

App. json is the global configuration of wechat applets

Page. json is the configuration of the page. If the configuration in page.json is the same as that in app.json, the configuration in app.json is overwritten.

Json, which is the configuration of the current project

Sitemap. json, configuration of wechat applets search rules

App. js, app. WXSS, and app.json must be in the root directory of the applet

app.json

The app.json file is used for global configuration of wechat applets, such as the number of page files, window performance, bottom tabs, etc.

The app.json file must be in the root directory of the wechat applet.

For more information about JSON, see www.json.org

app.jsonThe file structure is as follows:

{
 "pages": []."entyPage": "Path of wechat mini program home page"."window": {
 "navigationBarTitleText": "Navigation bar title text"."navigationBarTextStyle": "Navigation title text color (black | white)"."navigationBarBackgroundColor": "Navigation bar background color"."backgroundTextStyle": The style of the "drop-down loading (dark | light)"."enablePullDownRefresh":true|false."backgroundColor": "Window background color"
},
"tabBar": {
 "color": "Text color for normal display"."selectedColor": "Text color when selected"."list": [{"text": "Displayed text"."pagePath": "Page path and must already exist in Pages"."iconPath": "Icon file path for normal display"."selectedIconPath": "Icon file path when selected"}}}]Copy the code

Partial file structure explanation

Pages property is used to set the number of pages and storage location of wechat applet, array type, such as

{
"pages": ["pages/index/index"."pages/cart/cart"]}Copy the code

If the entryPagePath property is not specified, the first entry in the array represents the initial page of the applet (the first page)

The entryPagePath attribute is used to specify the page path of the initial page (home page) of wechat applet. It must ensure that:

  • The page path already exists in the Pages array

  • The page path cannot have parameters

Window property is used to set the title bar of the applet, window background color, etc., object type

The enablePullDownRefresh attribute controls whether to enable the global drop-down refresh function. The value is a Boolean

The tabBar property is used to set the bottom TAB, of type Object

The tabbar. list property is used to set the number of bottom tabs and the page path, and the array type, including at least 2 and up to 5 tabs

conclusion

Ok, that’s all for today’s article, thanks for your patience to read it, ❤❤❤❤❤❤❤❤ ❤