instructions

This paper recorded the small program project development process stepped on the pit, convenient reference in the future.

The problem

Taro – UI problem

Taro-ui is used as the front-end UI framework in the company’s project. Since it is a third-party framework, there must be bugs in some places. How to solve the bug to complete the business, is the problem we need to solve. Based on previous development experience, the following solutions and possible problems are roughly listed:

  1. Make your own issue and let the official solve it (you may not get a reply)

  2. Don’t use his, write your own (workload explodes)

  3. Make a copy of the source code of the component in question to your own project to solve the bug (changing the source code is difficult)

The header navigation bar is faulty

By default, the head navigation bar of wechat applet is displayed differently on ios and Android devices. Ios title center; On Android devices, the title is aligned to the left, and the navigation bar of the applet header does not support customization. Projects may require the applets to be presented consistently across multiple ends, or custom navigation bar functions. This is where custom components are needed.

  • Use the taro-Navigationbar address
  • If the project does not require, it can be displayed with the default style of wechat

Small package size limitation problem

When developing wechat applets, we often encounter the problem that the package size exceeds the limit. When we write two lines of code, we will give you a warning if the package size exceeds 2M.

Currently, the subcontracting size of small program has the following limitations:

  • The whole small program all subcontracting size is not more than 20M
  • The size of a single subcontract/main package cannot exceed 2M

Here’s what the official documentation says, and the solution is pretty simple:

  • Try to reduce the size of the package, such as: still image resources to the server
  • Or follow the documentation: subcontract

The project.config.json configuration file is faulty

Most of the time we need to carry out development and debugging, using the preview function of wechat developer tools to view the implementation effect on the real machine. To facilitate debugging, we will set the compile mode. However, compile mode changes are written to the condition field of the project.config.json file, and the project has only one proje.config. json file. So when the team was working together, everyone was adding their own compilation mode, which caused a bit of trouble for the team. Solutions are as follows:

  1. In the gitignore file to add project. Config. Json, project. Private. Config. Json
  2. For a project to introduce project. Config. Json. The example file as a template project configuration file
  3. Team members use project. Private. Config. Json as a personal configuration (preferably in the configuration file will be used)