
{ "pages": [ //pages數組中第一項表示應用啟動頁,參考:https://uniapp.dcloud.io/collocation/pages { "path": "pages/index/index", "style": { "navigationBarTitleText": "uni-app" } }, { "path": "pages/index/index0", "style": { "navigationBarTitleText": "uni-app000" // "app-plus":{ // "titleNView":{ // "buttons":[ // { // "type":"back", // "color":"#333333", // "text":"返回", // "float":"left" // } // ] // } // } } }, { "path": "pages/components/shitu", "style": { "navigationBarTitleText": "視圖", "navigationBarBackgroundColor":"#333333", "navigationBarTextStyle":"white",//導航字體顏色 "enablePullDownRefresh":true,//是否下拉刷新 "navigationStyle":"default",//設置為custom導航欄消失 "app-plus": { "bounce":"none", // "animationType": "slide-in-right", // "animationDuration": 300000, "titleNView": { "titleText":"設置視圖文件", "buttons":[ { "type":"back", "color":"#FFFFFF", "float":"left" }, { "type":"share", // "text":"\ue534", "colorPressed":"#c8000a", "color":"#FFFFFF", "float":"right", "badgeText":"12", "redDot":true } ] } } } } ], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "uni-app", "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" }, "tabBar":{ "color":"#4CD964", "backgroundColor":"#333333", "fontSize":"14px", "height":"44px", "selectedColor":"#007AFF", "position":"bottom", "list":[ { "pagePath":"pages/components/shitu", "iconPath":"static/logo.png", "selectedIconPath":"static/logo.png", "text":"組件" }, { "pagePath":"pages/index/index", "iconPath":"static/logo.png", "selectedIconPath":"static/logo.png", "text":"API" } // , // { // "pagePath":"pages/index/index0", // "iconPath":"static/logo.png", // "selectedIconPath":"static/logo.png", // "text":"API01" // } ] } }
描述:tabBar跳轉的路由 默認header 是沒有返回按鈕的 只有其他方式跳轉的頁面 會顯示返回鍵(tabBar默認是沒有上一頁所以 不需要顯示返回鍵)
如果想顯示返回鍵 需要 自定義 頂部導航;
bug1:自定義導航(需要在頁面利用onNavigationBarButtonTap方法監聽其中要注意 當前方法 與data同級)如果利用 uni.navigateTo返回(tabBar其中的路徑會報錯:navigateTo:fail can not navigateTo a tabbar page)需要用到uni.switchTab才可以跳轉;
onNavigationBarButtonTap(e) { console.log(this) console.log(this.$mp) uni.switchTab({ url: '/pages/index/index' }) // uni.navigateBack({ // delta: 2 // }); // history.back(2) // this.$router.history.go(-1) }