The pitfalls of WeChat applet development

Source: Internet
Author: User
From internal testing to open public beta, applets have become the hottest topic in the IT field. apart from exploring the possibility of different types of applications, for the development team, the most common problems are those that have been trampled on. Collation

From internal testing to open public beta, applets have become the hottest topic in the IT field. apart from exploring the possibility of different types of applications, for the development team, the most common problems are those that have been trampled on.

What does a applet provide to developers?

What is a applet?

A applet is a new form of public account launched. it can be used in the application without the need to download and install it. At the same time, it should be noted that applets, subscription numbers, service numbers, and enterprise numbers are parallel systems.

MINA framework

A applet provides a framework called "MINA", which consists of two layers: the View layer and the logic layer. The core of the framework is a response data binding system. The dynamic data in WXML comes from the data of the corresponding Page. this data binding is unidirectional. the view can be adjusted only when the data changes. This mode allows developers to focus on event processing, change the object status, and update views.

Provides several page jump methods, including redirectto, navigateto, and return. Specifically, redirectto will directly open a new page on the original page, and navigateto will open a new page. Due to the limited number of pages, there are many levels of our products, so you cannot directly set the Tab bar in app. json. Therefore, we design the Tab bar separately. Click Tab to open the new page. Each primary page is referenced. after that, the secondary page does not use Tab switching, but needs to be returned to the primary page.

2. tree structure display

This is a very difficult problem to solve. HTML page display is not supported. Therefore, you need to convert all HTML tags into the tags allowed in the applet. We use an application named wxParse. its function is to convert an HTML page into a JSON format through a regular expression and display it in a template. The style of each label (WXSS) is specified here ). Unfortunately, it also has hierarchical issues, and many identical templates are repeatedly written.

If the tag hierarchy of HTML exceeds the number of templates, the excess part cannot be displayed. This application is running in. we recommend that you put the data into the server and send the converted data to the applet. In addition, the setData () of a small program cannot exceed 1024 KB at a time. if your JSON format data exceeds this limit, it will be difficult to splice.

4. bubble events

After an event on a component is triggered, the event will be passed to the parent node, resulting in unnecessary logic processing. for this, the usage fee bubble event is processed.

5. The network request interface wx. request () does not carry Cookies

If the server side does not have the ability to combine the cookie processing logic with the applet, it can only develop new interfaces for the applet.

The advantage of small programs in operation is that a large number of users are suitable for promotion. some apps with a single function can be implemented in small programs without downloading them. Developers do not need to consider the platform, and the development cost is low. At the same time, it is not suitable for developing programs with complex logic interfaces. it is limited by the framework and has low randomness and cannot satisfy all functions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.