Home  >  Article  >  WeChat Applet  >  Why is the tabbar component in the mini program not displayed?

Why is the tabbar component in the mini program not displayed?

王林
王林forward
2021-03-03 09:50:562996browse

Why is the tabbar component in the mini program not displayed?

Foreword:

For those who often develop small programs, the tabBar component should be a very familiar component. I thought I already knew it very well, but today’s encounter made me fully understand it. Today I developed a small program as usual, but unexpectedly found that I set the tabBar but it was not displayed. What's going on? So with doubts, I started to slowly investigate the problem.

The solution is as follows:

First of all, if the tabBar is not displayed, check whether the page it points to has been registered. If you are not registered, the page cannot be found.

Secondly, make sure that the path is spelled correctly. I don’t know why the WeChat development tool for the Windows platform does not have a code prompt when setting the tabBar list, so I can only spell the full name of the path myself. At this time, I must Pay attention to the correctness of the spelling, otherwise the tabBar will not be found after the page is loaded, but the Console will not report any errors if it cannot be found, so be sure to pay attention to the spelling of the path, just like when I set the pagePath attribute of the list. , write "Component" out of "Componnet"

Finally, under the premise of ensuring that the page path is correct, the tabBar still does not appear. I tried many times and finally found the reason, because I was working on Android before. In Android, there is a similar component called TabHost. TabHost is included in an Activity, including the pointed Activity (assuming 3 Activities), a total of 4 Activities. However, in the WeChat applet, if you follow this model, that is If a page contains three pages, then I'm sorry, the tabBar cannot be displayed normally. The startup page in the WeChat applet must be included in the tabBar, and the startup page must be the first element in the list attribute of the tabBar. Normal display, Android students can easily get entangled in this place.

Related recommendations: Mini Program Development Tutorial

The above is the detailed content of Why is the tabbar component in the mini program not displayed?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:微信开放社区. If there is any infringement, please contact admin@php.cn delete