tabBar : 底部tab切换
- 当设置 position 为 top 时,将不会显示 icon。
- tabBar 中的 list 是一个数组,只能配置最少2个、最多5个 tab,tab 按数组的顺序排序。
- 代码跳转到 tabbar 页面,只能使用uni.switchTab,不能使用uni.navigateTo、uni.redirectTo;使用navigator组件跳转时必须设置open-type="switchTab"。
- navigationStyle : 导航栏样式,仅支持 default/custom。custom即取消默认的原生导航栏。(用uniapp开发小程序时必须取消默认导航栏)。
- enablePullDownRefresh :是否开启下拉刷新。
在page.json中添加以下代码:
{
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/my/index",
"style": {
"navigationBarTitleText": "我的",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"app-plus": {
"background": "#efeff4"
}
},
"tabBar": {
"color": "#999999",
"selectedColor": "#000000",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/image/icon-index.png",
"selectedIconPath": "static/image/icon-index-active.png",
"text": "首页"
}, {
"pagePath": "pages/my/index",
"iconPath": "static/image/icon-my.png",
"selectedIconPath": "static/image/icon-my-active.png",
"text": "我的"
}]
}
}