微信小程序学习之底部导航栏

首先,我们在app.json中添加4个页面,

复制代码
"pages": [
    "pages/index/index",
    "pages/category/category",
    "pages/cart/cart",
    "pages/user/user"
  ],

其次我们把8张图片放到imaes文件夹下,

图标可以去https://www.iconfont.cn/下载

然后添加tabBar项(已经加上注释):

复制代码
"tabBar": {
    // 文字的颜色
    "color": "#666",
    // 选中项文字颜色
    "selectedColor": "#fa2c19",
    // 导航的栏目
    "list":[
      {
        // 导航页面的地址
        "pagePath": "pages/index/index",
        // 导航项的说明文字
        "text": "首页",
        // 导航项的默认图片
        "iconPath": "./images/shouye.png",
        // 导航项的选中图片
        "selectedIconPath": "./images/shouye_select.png"
      },
      {
        "pagePath": "pages/category/category",
        "text": "类别",
        "iconPath": "./images/leibie.png",
        "selectedIconPath": "./images/leibie_select.png"
      },
      {
        "pagePath": "pages/cart/cart",
        "text": "购物车",
        "iconPath": "./images/gouwuche.png",
        "selectedIconPath": "./images/gouwuche_select.png"
      },
      {
        "pagePath": "pages/user/user",
        "text": "用户",
        "iconPath": "./images/yonghu.png",
        "selectedIconPath":"./images/yonghu_select.png"
      }
    ]
  }

保存。

效果图:

相关推荐
kyh10033811203 小时前
Cocos Creator 《打螺丝消除游戏》源码+实现
游戏·微信小程序·小程序·打螺丝小游戏源码·微笑小游戏源码
PeanutSplsh10 小时前
wx.setStorage 存的数据,没你以为的那么安全
微信小程序
帅次13 小时前
讯飞与腾讯云:Android 实时语音识别服务对比选择
android·ios·微信小程序·小程序·android studio·android runtime
he___H16 小时前
微信小程序实现两行交错功能
微信小程序·小程序
前端小木屋1 天前
uniapp与蓝牙设备连接详细步骤
前端·微信小程序
huang_jimei2 天前
【无标题】
微信小程序
Brave & Real2 天前
小程序 const 在js中以及与同类的var和let之间的差异
javascript·微信小程序·小程序
silvia_Anne3 天前
微信小程序商品列表
微信小程序·小程序
ze^03 天前
Day05 APP应用&微信小程序&原生态开发&H5+Vue技术&封装打包&反编译抓包点
vue.js·微信小程序·小程序
用户8574824354804 天前
useList 通用列表管理hook
vue.js·微信小程序