Solution to the problem displayed on the tabbar page during WeChat applet development

Source: Internet
Author: User
This article describes how to solve the problem displayed on the tabbar page during applet development, if you are interested in tabbar development, I believe you will encounter some problems. In some cases, the tabbar has been added to app. json in the code, so it is not displayed on the page? Can some pages show tabbar while some pages do not? Today, I will sort out the problems I encountered during the development process and share them with you.
Question 1: Why is no tabbar displayed at the bottom of the page?
Many netizens (including myself) have also encountered such problems. tabbar is clearly added to app. json, and paths are also added to the list. why not display them? For example, the following code shows why tabbar does not appear at the bottom of the screen page as scheduled?

{"Pages": ["pages/clickDemo", "pages/logs", "pages/index", "pages/mypage"], "window": {"backgroundTextStyle": "dark", "navigationBarBackgroundColor": "# ddd", "navigationBarTitleText": "Tabbar Demo", "navigationBarTextStyle": "black ", "backgroundColor": "# ff0000"}, "tabBar": {"color": "#000000", "borderStyle": "#000", "selectedColor ": "# 9999FF", "list": [{"pagePath": "pages/index", "text": "homepage", "iconPath ": "image/location_normal.png", "selectedIconPath": "image/location_selected.png" },{ "pagePath": "pages/logs", "text": "settings ", "iconPath": "image/setting_normal.png", "selectedIconPath": "image/setting_selecred.png"}]}

The page shows the following results:

Let's take a look at the content of the pages array in the above code:

"pages":["pages/clickDemo/clickDemo","pages/logs/logs","pages/index/index","pages/mypage/mypage"]

The content of the list array in tabbar is:

"List": [{"pagePath": "pages/index", "text": "homepage", "iconPath": "image/location_normal.png", "selectedIconPath ": "image/location_selected.png" },{ "pagePath": "pages/logs", "text": "settings", "iconPath": "image/setting_normal.png ", "selectedIconPath": "image/setting_selecred.png "}

Why is no TabBar displayed at the bottom? The reason is that the app. the first item of the pages array in the json header "pages/clickDemo" is not a member of the tabBar, that is, the entries that do not link to the clickDemo page in the list array of the tabBar.

[Solution] 1. add the entry linking the clickDemo page to the list array. the following code is provided.

{"PagePath": "pages/clickDemo", "text": "event Demo", "iconPath": "image/setting_normal.png", "selectedIconPath ": "image/setting_selecred.png "}

The effect is as follows:

[Solution] if the current page is also a level-1 page, you can use navigateTo instead of redirectTo to access the page you want to jump to without Tabbar.

The above is a detailed explanation of the solution to the problem displayed on the tabbar page during applet development. For more information, see other related articles in the first PHP community!

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.