Project Structure of WeChat Mini Program

1. Create a WeChat Mini Program

1. Create applet configuration

insert image description here

2. Mini Program project file description

2.1 project.config.jsonModify the project name and appid

project.config.json(Manual modification appid, 项目名称 projectname)
The configuration here basically does not need to be modified manually, and
insert image description here
can be modified by checking the corresponding content.

2.2 sitemap.json

sitemap.jsonThe file in the root directory of the applet is used to configure whether the applet and its pages are allowed to be indexed by WeChat . The content of the file is a JSON object. If there is no sitemap.json, all pages are allowed to be indexed by default

WeChat has now opened search within the Mini Program. Developers can configure whether their Mini Program pages allow WeChat indexing through the sitemap.json configuration, or manage the page inclusion switch in the background.
When the developer allows WeChat to index, WeChat will use crawlers to index the page content of the Mini Program. When the user's search term triggers the index, the page of the Mini Program may be displayed in the search results.

2.3 app

insert image description here
The abbreviation of app application, the main component of rendering

app.js

Register the entire Mini Program application
Register the Mini Program. It accepts an Object parameter, which specifies the life cycle callback of the applet, etc.

App (Object object), must be called in app.js, must be called and can only be called once. Otherwise there will be unpredictable consequences.
insert image description here
It is similar to the life cycle of vue

app.json


Globally configure the pages configuration page for the WeChat applet , the first one defaults to the home page, of course you can also entryPagePathconfigure the home page.
insert image description here

insert image description here
insert image description here

app.wxss

Like css,
since each page has its own style file, app.wxss places common styles.

2.4 pages

The web page, 新建页面when it is added, will automatically write the path into the pages array in app.json

2.5 utils

  • utils tool class use
  • Used to declare the method, pay attention to including it in module.exports, otherwise the call will not find the method

Guess you like

Origin blog.csdn.net/weixin_46372074/article/details/125785392
Recommended