微信小程序——自定义底部菜单

开发微信小程序时通常需要自定义底部菜单内容,来实现不同的主要页面之间的切换。想要实现此功能只需要在 app.json 中配置即可。
  • 具体代码如下:
"pages": [ ... ],
"window": { ... },
"tabBar": {
    "list": [
      {
        "pagePath": "pages/index/index",			// 此菜单切换的页面路径,必须是包含在 pages 中的路径
        "text": "首页",								// 菜单描述
        "iconPath": "images/shouye1.png",			// 菜单默认图标
        "selectedIconPath": "images/shouye2.png"	// 菜单被选中后的图标
      },
      {
        "pagePath": "pages/news/news",
        "text": "资讯",
        "iconPath": "images/zixun1.png",
        "selectedIconPath": "images/zixun2.png"
      },
      {
        "pagePath": "pages/user/user",
        "text": "我的",
        "iconPath": "images/wode1.png",
        "selectedIconPath": "images/wode2.png"
      }
    ],
    "position": "bottom",		// 菜单位置,一般固定在底部
    "color": "#000000",			// 菜单字体默认颜色
    "selectedColor": "#FF6347"	// 菜单字体被选中后的颜色
  }
  • 效果展现
    底部菜单
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值