⼩程序tabBar底部导航不显⽰问题解析
2019年⼗⽉⼋号
{
"pages": [
"pages/splash/splash",
"pages/zhuye/zhuye",
selectediconpath什么意思"pages/list/list",
"pages/item/item",
"pages/search/search",
"pages/profile/profile"
],
"window": {
"navigationBarBackgroundColor": "#35495e",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "电影 « ⾖瓣",
"backgroundColor": "#fff",
"backgroundTextStyle": "dark",
"enablePullDownRefresh": true
},
"tabBar": {
"list": [
{
"pagePath": "pages/zhuye/zhuye",
"iconPath": "images/board.png",
"selectedIconPath": "images/board-actived.png",
"text": "榜单"
},
{
"pagePath": "pages/search/search",
"iconPath": "images/search.png",
"selectedIconPath": "images/search-actived.png",
"text": "搜索"
},
{
"pagePath": "pages/profile/profile",
"iconPath": "images/profile.png",
"selectedIconPath": "images/profile-actived.png",
"text": "我的"
}
]
},
解决⽅案⼀:把 tabBar配置中的 "pagePath": "pages/zhuye/zhuye", 换成配置为⾸页的pages/splash/splash 就可以了;(简单说就是有底部导航栏的那个称为主页,主页就应该放到第⼀个位置上,初始值也是第⼀个)
⽅案⼆:完美解决⽅案 (这个是界⾯跳转模式)
在wxml⾥加⼊ open-type="switchTab"
<navigator url="../zhuye/zhuye" open-type="switchTab" >
<button class="btn" bindtap="start" wx:if="{{index == movies.length - 1}}" >⽴即体验</button>
</navigator>
⽅案三:
js⾥⾯⽤这个跳转带bar的页⾯(⼀般这个⽐较常⽤:)
//兼容详情返回⾸页底部消失的问题
wx.switchTab({
url : self.indexPagePath,//url路径
success(res){
},
fail(){ //容错处理
wx.navigateBack({
delta: 1,
fail:function(){
url: self.indexPagePath //url路径
})
}
})
}
})
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论