uni-app实现底部导航栏以及会遇到的bug解决办法

我们先来看一下效果:

我们只需要在pages.js配置一下即可:

"pages": [
		{ // 首页
			"path": "pages/index/index",
			"style": {
				"enablePullDownRefresh": true,
				"navigationBarBackgroundColor": "#fff",
				"navigationBarTextStyle": "black",
				"backgroundColorTop": "#F7F7F7",
				"backgroundColorBottom": "#F7F7F7",
				"onReachBottomDistance": 50,
				"navigationStyle": "custom",
				"app-plus": {
					"titleNView": false,
					"pullToRefresh": {
						"support": true,
						"color": "#fa436a",
						"style": "default"
					}
				}
			}
		},
		{ // 分类
			"path": "pages/classify/classify-index/index",
			"style": {
				"navigationBarTitleText": "分类",
				"onReachBottomDistance": 50,
				"app-plus": {
					"bounce": "none",
					"titleNView": false
				}
			}
		},
		{ // 消息
			"path": "pages/notify/notify-index/index",
			"style": {
				"enablePullDownRefresh": true,
				"navigationBarTitleText": "消息中心",
				"app-plus": {
					"bounce": "none",
					"pullToRefresh": {
						"support": true,
						"color": "#fa436a",
						"style": "default"
					}
				}
			}
		},
		{ // 购物车
			"path": "pages/cart/index",
			"style": {
				"enablePullDownRefresh": true,
				"navigationBarTitleText": "购物车",
				"navigationBarTextStyle": "black",
				"app-plus": {
					//          "titleNView": false,
					//          "softinputNavBar": "none",
					// 禁用原生导航栏
					"pullToRefresh": {
						"support": true,
						"color": "#fa436a",
						"style": "default"
					}
				}
			}
		},
		{
			"path": "pages/my/my-index/index",
			"style": {
				"navigationBarTitleText": "我的"
			}
		}
],
"tabBar": {
		"color": "#C0C4CC",
		"selectedColor": "#fa436a",
		"borderStyle": "black",
		"backgroundColor": "#ffffff",
		"list": [{
				"pagePath": "pages/index/index",
				"iconPath": "static/tabBar/tab-home.png",
				"selectedIconPath": "static/tabBar/tab-home-rf.png",
				"text": "首页"
			},
			{
				"pagePath": "pages/classify/classify-index/index",
				"iconPath": "static/tabBar/tab-cate.png",
				"selectedIconPath": "static/tabBar/tab-cate-rf.png",
				"text": "分类"
			},
			{
				"pagePath": "pages/notify/notify-index/index",
				"iconPath": "static/tabBar/tab-notify.png",
				"selectedIconPath": "static/tabBar/tab-notify-rf.png",
				"text": "消息"
			},
			{
				"pagePath": "pages/cart/index",
				"iconPath": "static/tabBar/tab-cart.png",
				"selectedIconPath": "static/tabBar/tab-cart-rf.png",
				"text": "购物车"
			},
			{
				"pagePath": "pages/my/my-index/index",
				"iconPath": "static/tabBar/tab-my.png",
				"selectedIconPath": "static/tabBar/tab-my-rf.png",
				"text": "我的"
			}
		]
	}

不要存在

// #ifdef MP
// #endif

判断语句,不然会报错

还有就是启动页要和首页路径保持一致

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值