Home WeChat Applet Mini Program Development Summarize the problems encountered in mini program development

Summarize the problems encountered in mini program development

Sep 12, 2017 am 09:33 AM
Applets Program development question

Summary of the problem:
(1) The problem of using rpx for the height of the dividing line
There will be a dividing line directly between two adjacent pieces of information. Set the height of the line to 1rpx. The two previous dividing lines are not displayed, but the others are displayed. The attributes of the dividing lines are the same, and the dividing lines that are not displayed on different mobile phones (different resolutions) are also different. Some resolutions have multiple lines. The dividing lines are not displayed. I don’t know if this is a bug in the simulator or a bug in rpx. Solution: The height size unit of the dividing line uses px, which solves this problem.

(2) Page registration problem
This error may be easy to understand, page registration error. The page is rendered through the Page object. The js file corresponding to each page must create a page. The simplest way is to write Page({}) under the js file. The life cycle of page rendering is managed in the page, and Data processing and events are all completed here. The reason for this error is usually that the page has just been created and the js file has not been processed or has been forgotten.
Solution: Get into the habit of creating a Page in the js file first when creating a page.

(3) Page route error
Caused by repeated calls to the route, the solution is to delete a route, delete component or delete wx.navigateTo.

(4) Don't have * Handle in current page.
In fact, this kind of problem usually occurs when we define some processing events in wxml, but the processing of this event is not implemented in the js file. method, this error will occur. Then we follow the prompts and add event processing to the js file
Solution: Don’t miss any method to call the event

(5) TabBar is set not to be displayed
There are many reasons why the tabBar is not displayed , to find this error, go directly to the app.json file

The page is not registered in app.json

tabBar is not displayed due to incorrect writing, and the uppercase letter B is written in lowercase, resulting in tabBar does not display

The pagePath field is not written in the list of tabBar, or the page in pagePath is not registered

The page specified by the pagePath of the list of tabBar is not written as the first one on the registration page. The logic of the WeChat applet is that the first page in "pages" is the homepage, which is the first page displayed after the program is started. If the page specified by the pagePath of the tabBar list is not the first page of pages, of course it will The tabBar will not be displayed.

The number of tabBar is less than two items or more than five items. WeChat official clearly stipulates that the tabBar must have at least two items and a maximum of five items. The tabBar will not be displayed if it is more than or less than.

(6) wx.navigateTo cannot open the page
An application can only open 5 pages at the same time. After 5 pages have been opened, wx.navigateTo cannot open a new page normally. Please avoid multi-level interactions, or use wx.redirectTo

(7) Local resources cannot be obtained through css
background-image: You can use network images, or base64, or use

(8) Page data transfer
WeChat applet routing (page jump) is implemented through the API wx.navigateTo or the component in wxml, no matter which implementation will An important parameter is the url, which specifies the page to be jumped, and the data transfer between pages is also implemented through the url. This data transfer is somewhat similar to the get network request we use. The parameters are spliced ​​into the page to be jumped. Go to the end of the interface address and connect it with "?" Then append the data to be passed in the form of key and value after "?", and multiple parameters are directly matched with "&". You can write it like this

<navigator url="/pages/dynamic/dynamic?title={{item.title}}&message={{item.message}}">
<view class="item" >
<view class="item-left">
<image src="{{item.url}}" class="image"/>
</view>
<view class="item-middle">
<view>
<text class="title">{{item.title}}</text>
</view>
<view>
<text class="message">{{item.message}}</text>
</view>
</view>
<view class="item_right">
<view><text class="time">{{item.time}}</text></view>
<view class="mark" wx:if="{{item.count>0}}"><text class="text">{{item.count}}</text></view>
</view>
</view>
<view class="line"></view>
</navigator>
Copy after login

The data is received in the page of the js file. The page life cycle has an onLoad function, which does some work of initializing the data. The onLoad function has a parameter options, and we can Obtain data through key, as follows

onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
console.log(options.title) //这里是接收参数
console.log(options.message)
},
Copy after login

This realizes the data transfer function between pages.

The above is the detailed content of Summarize the problems encountered in mini program development. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Implement card flipping effects in WeChat mini programs Implement card flipping effects in WeChat mini programs Nov 21, 2023 am 10:55 AM

Implementing card flipping effects in WeChat mini programs In WeChat mini programs, implementing card flipping effects is a common animation effect that can improve user experience and the attractiveness of interface interactions. The following will introduce in detail how to implement the special effect of card flipping in the WeChat applet and provide relevant code examples. First, you need to define two card elements in the page layout file of the mini program, one for displaying the front content and one for displaying the back content. The specific sample code is as follows: &lt;!--index.wxml--&gt;&l

Clustering effect evaluation problem in clustering algorithm Clustering effect evaluation problem in clustering algorithm Oct 10, 2023 pm 01:12 PM

The clustering effect evaluation problem in the clustering algorithm requires specific code examples. Clustering is an unsupervised learning method that groups similar samples into one category by clustering data. In clustering algorithms, how to evaluate the effect of clustering is an important issue. This article will introduce several commonly used clustering effect evaluation indicators and give corresponding code examples. 1. Clustering effect evaluation index Silhouette Coefficient Silhouette coefficient evaluates the clustering effect by calculating the closeness of the sample and the degree of separation from other clusters.

Alipay launched the 'Chinese Character Picking-Rare Characters' mini program to collect and supplement the rare character library Alipay launched the 'Chinese Character Picking-Rare Characters' mini program to collect and supplement the rare character library Oct 31, 2023 pm 09:25 PM

According to news from this site on October 31, on May 27 this year, Ant Group announced the launch of the "Chinese Character Picking Project", and recently ushered in new progress: Alipay launched the "Chinese Character Picking-Uncommon Characters" mini program to collect collections from the society Rare characters supplement the rare character library and provide different input experiences for rare characters to help improve the rare character input method in Alipay. Currently, users can enter the "Uncommon Characters" applet by searching for keywords such as "Chinese character pick-up" and "rare characters". In the mini program, users can submit pictures of rare characters that have not been recognized and entered by the system. After confirmation, Alipay engineers will make additional entries into the font library. This website noticed that users can also experience the latest word-splitting input method in the mini program. This input method is designed for rare words with unclear pronunciation. User dismantling

How uniapp achieves rapid conversion between mini programs and H5 How uniapp achieves rapid conversion between mini programs and H5 Oct 20, 2023 pm 02:12 PM

How uniapp can achieve rapid conversion between mini programs and H5 requires specific code examples. In recent years, with the development of the mobile Internet and the popularity of smartphones, mini programs and H5 have become indispensable application forms. As a cross-platform development framework, uniapp can quickly realize the conversion between small programs and H5 based on a set of codes, greatly improving development efficiency. This article will introduce how uniapp can achieve rapid conversion between mini programs and H5, and give specific code examples. 1. Introduction to uniapp unia

Teach you how to diagnose common iPhone problems Teach you how to diagnose common iPhone problems Dec 03, 2023 am 08:15 AM

Known for its powerful performance and versatile features, the iPhone is not immune to the occasional hiccup or technical difficulty, a common trait among complex electronic devices. Experiencing iPhone problems can be frustrating, but usually no alarm is needed. In this comprehensive guide, we aim to demystify some of the most commonly encountered challenges associated with iPhone usage. Our step-by-step approach is designed to help you resolve these common issues, providing practical solutions and troubleshooting tips to get your equipment back in peak working order. Whether you're facing a glitch or a more complex problem, this article can help you resolve them effectively. General Troubleshooting Tips Before delving into specific troubleshooting steps, here are some helpful

How to solve the problem that jQuery cannot obtain the form element value How to solve the problem that jQuery cannot obtain the form element value Feb 19, 2024 pm 02:01 PM

To solve the problem that jQuery.val() cannot be used, specific code examples are required. For front-end developers, using jQuery is one of the common operations. Among them, using the .val() method to get or set the value of a form element is a very common operation. However, in some specific cases, the problem of not being able to use the .val() method may arise. This article will introduce some common situations and solutions, and provide specific code examples. Problem Description When using jQuery to develop front-end pages, sometimes you will encounter

Label acquisition problem in weakly supervised learning Label acquisition problem in weakly supervised learning Oct 08, 2023 am 09:18 AM

The label acquisition problem in weakly supervised learning requires specific code examples. Introduction: Weakly supervised learning is a machine learning method that uses weak labels for training. Different from traditional supervised learning, weakly supervised learning only needs to use fewer labels to train the model, rather than each sample needs to have an accurate label. However, in weakly supervised learning, how to accurately obtain useful information from weak labels is a key issue. This article will introduce the label acquisition problem in weakly supervised learning and give specific code examples. Introduction to the label acquisition problem in weakly supervised learning:

How to get membership in WeChat mini program How to get membership in WeChat mini program May 07, 2024 am 10:24 AM

1. Open the WeChat mini program and enter the corresponding mini program page. 2. Find the member-related entrance on the mini program page. Usually the member entrance is in the bottom navigation bar or personal center. 3. Click the membership portal to enter the membership application page. 4. On the membership application page, fill in relevant information, such as mobile phone number, name, etc. After completing the information, submit the application. 5. The mini program will review the membership application. After passing the review, the user can become a member of the WeChat mini program. 6. As a member, users will enjoy more membership rights, such as points, coupons, member-exclusive activities, etc.

See all articles