Taro3. 4 example of developing wechat applet

Time:2022-5-10

1、 Install scaffolding and initialize project

Install scaffold

Initialization is shown in the figure below. Select vue3, less and vue3 nutui templates:

Taro3. 4 example of developing wechat applet

initialization

2、 Installation package audit and version check

After installation, some alarm prompts may appear and prompt NPM audit, as shown in the following figure

Taro3. 4 example of developing wechat applet

Installation package audit

If you ignore it, an error will be reported when running dev, and the error prompt is difficult to understand.

Taro3. 4 example of developing wechat applet

report errors

The reason for this error is that the taro version is inconsistent. You need to run NPM audit fix to repair it. After repair, it will run normally.

Taro3. 4 example of developing wechat applet

Prompt after repair

3、 Design pages with nutui

3.1 introduction of components

Taro3. 4 example of developing wechat applet

app. JS import component

3.2 page usage components

Taro3. 4 example of developing wechat applet

Page usage component

Nutui several interesting components, such as table, card and fixednav

Taro3. 4 example of developing wechat applet

Display effect

4、 Using wechat applet cloud development

4.1 init initialization

app. JS and enter the cloud development ID

Taro3. 4 example of developing wechat applet

app.js

4.2 writing cloud functions (otherwise specified)

Taro3. 4 example of developing wechat applet

Cloud function example

4.3 calling cloud functions

Taro3. 4 example of developing wechat applet

Call cloud function

Taro3. 4 example of developing wechat applet

Call result

5、 A little personal summary

For multi terminal display, taro should have its advantages. If it is only used for wechat applet development, it is better to use wechat developer tools.

Recommended Today

Java spring boot uses custom annotations to verify JSON schema

1、 First, there are two open source tools https://github.com/everit-org/json-schema and https://github.com/java-json-tools/json-schema-validator Difference: in terms of performance, everit is completely rolled FGE, which is at least twice what the official said. In the actual test process, there is almost a gap of 20 times. Although FGE uses Jackson JSON, which may have a relatively low learning […]