2021-09-07

一、tabBar

1.tabBar

tabBar是底部导航,在pages.json中配置,代码如下:

"tabBar": {
	    "color": "#333333",
	    		"selectedColor": "#f06c7a",
	    		"borderStyle": "black",
	    		"backgroundColor": "#FFFFFF",
	    "list": [{
	        "pagePath": "pages/index/index",
	        "iconPath": "static/img/tabBar/home.png",//图片地址
	        "selectedIconPath":"static/img/tabBar/home-on.png",//选中 后图片的样子
	        "text": "首页"
	    }, {
	        "pagePath": "pages/catalog/catalog",
	        "iconPath": "static/img/tabBar/category.png",
	       "selectedIconPath":"static/img/tabBar/category-on.png",
	        "text": "分类"
	    },
		{
		    "pagePath": "pages/cart/cart",
		    "iconPath": "static/img/tabBar/cart.png",
		   "selectedIconPath":"static/img/tabBar/cart-on.png",
		    "text": "购物车"
		},
		{
		    "pagePath": "pages/profile/profile",
		    "iconPath": "static/img/tabBar/user.png",
		    "selectedIconPath":"static/img/tabBar/user-on.png",
		    "text": "我的"
		}
		]
	}

注意:代码要放在globalStyle外面。

2.tabBar的一些属性说明

在这里插入图片描述

3.tabBar中list的一些属性说明

pagePath:页面的路径
text:文字
iconPath:图片的路径
selectedIconPath:选中时图片的路径

4.tabBar中midButton 的一些属性说明

width:按钮的宽度
height:按钮的高度
text:按钮上面的文字
iconPath:中间按钮的文字路径
iconWidth:图片的宽度,高度会等比例缩放
backgroundImage:按钮的背景图片的路径

总结

uni-app的学习要和官方文档相结合,官网地址是https://uniapp.dcloud.io/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值