2.配置tabBar

创建页面

分别创建home(首页)、write(发布)、unused(闲置)、buy(求购)、mine(我的)页面

  1. 点击shop-zy -> src -> pages
  2. 修改其中默认的index文件
    在这里插入图片描述将选中部分改为首页
  3. 在pages中新建页面
    在这里插入图片描述
    注意勾选在pages.json中注册
  4. 分别创建home(首页)、write(发布)、unused(闲置)、buy(求购)、mine(我的)页面

配置tabBar

官网地址
https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar

pages.json

  1. 在pages.json 的pages中添加每个页面的名称
  2. 在globalStyle设置应用的状态栏、导航条、标题、窗口背景色等
"globalStyle": {
    //导航字体颜色,仅支持black和white
		"navigationBarTextStyle": "white",
    //导航全局标题,当前页面没有配置时生效
		"navigationBarTitleText": "简易二手交易",
    //导航字体颜色
		"navigationBarBackgroundColor": "#79b2f8",
    //下拉显示出来的窗口的背景色
		"backgroundColor": "#F8F8F8"
	}
  1. 添加tabBar(可复制官网代码示例)
  2. tabBar图标制作
    注册/登录iconfont官网
    https://www.iconfont.cn/
"tabBar": {
  	"color": "#7A7E83",
    //默认文字颜色
  	"selectedColor": "#376199",
    //选中文字颜色
  	"borderStyle": "black",
    //上边框颜色
  	"backgroundColor": "#ffffff",
  	"list": [{
  		"pagePath": "pages/index/index",
  		"iconPath": "static/home.png",
      //默认图片
  		"selectedIconPath": "static/home_select.png",
      //选中后图片
  		"text": "首页"
  	}, {
  		"pagePath": "pages/unused/unused",
  		"iconPath": "static/unused.png",
  		"selectedIconPath": "static/unused_select.png",
  		"text": "闲置"
  	}, {
  		"pagePath": "pages/write/write",
  		"iconPath": "static/write.png",
  		"selectedIconPath": "static/write_select.png",
  		"text": "发布"
  	}, {
  		"pagePath": "pages/buy/buy",
  		"iconPath": "static/buy.png",
  		"selectedIconPath": "static/buy_select.png",
  		"text": "求购"
  	}, {
  		"pagePath": "pages/mine/mine",
  		"iconPath": "static/mine.png",
  		"selectedIconPath": "static/mine_select.png",
  		"text": "我的"
  	}]
  }

效果图

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值