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