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!