Issues related to the tabbar page for applet development and troubleshooting

Source: Internet
Author: User
If you have used tabbar during the development of mini-programs, I believe you will encounter some troubles. In some cases, the tabbar has been added to app. json in the code, so it is not displayed on the page? Can I display tabbar on some pages, but not some pages ...,

During the development of the applet yesterday, a tabbar was clearly defined but never displayed. Searching on the internet finds that many of the students who have used tabbar in the development of small programs also encounter the same

Confusions. 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 with you the small program development tutorial.

Question 1: Why is no tabbar displayed at the bottom of the page?

Many netizens (including myself) have encountered such problems. I would like to remind everyone to think about it and check whether it is correct! TabBar when writing correctly. do not write it as tabbar! If you confirm that the writing is correct, tabbar and list are explicitly added to app. json.

Why not display the path when it is added? 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 ":{

& Quot; color & quot;: & quot; #000000 & quot ",

"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:


The reason is:The first entry of the pages array must be a member of the list array of tabBar.
Let's take a look at the content of the pages array in the above code:

"Pages ":[

"Pages/clickDemo ",

"Pages/logs ",

"Pages/index ",

"Pages/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 first item of the pages array in the app. json header "pages/clickDemo" is not a member of the tabBar, that is, there is no link to the click in the list array of the tabBar.

Demo page entry.
[Solution 1]. we add a link to the clickDemo page in 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:


The above is the detailed content about the issues and solutions displayed on the tabbar page for 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.