前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【笔记】微信小程序通过app.json设置底部导航

【笔记】微信小程序通过app.json设置底部导航

作者头像
德顺
发布2019-11-13 17:27:59
8290
发布2019-11-13 17:27:59
举报
文章被收录于专栏:前端资源

首先,您可以在阿里图标库选择合适的图标,使用方法参见我之前写的文章:阿里巴巴矢量图标库 iconfont 的使用方法

我选了几个图标,选中不选中颜色有个区分:

底部菜单最少设置2个最多可以设置5个。

找到项目根目录的配置文件 app.json 加入如下配置信息:

代码语言:javascript
复制
"tabBar": {
    "color": "#a9b7b7",
    "selectedColor": "#E50012",
    "borderStyle": "white",
    "list": [
      {
        "selectedIconPath": "images/index_h.png",
        "iconPath": "images/index.png",
        "pagePath": "pages/index/index",
        "text": "首页"
      },
      {
        "selectedIconPath": "images/tel_h.png",
        "iconPath": "images/tel.png",
        "pagePath": "pages/index/index",
        "text": "联系我们"
      },
      {
        "selectedIconPath": "images/my_h.png",
        "iconPath": "images/my.png",
        "pagePath": "pages/index/index",
        "text": "我的"
      }
    ]
  }

tabBar 是底部菜单

color 字体颜色

borderStyle tabbar上边框的颜色, 仅支持 black/white

list 列表

selectedIconPath 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效

iconPath 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效,不支持网络图片

pagePath 页面路径,必须在 pages 中先定义

text tab上按钮文字

参考文档:https://developers.weixin.qq.com/miniprogram/dev/framework/config.html

效果如图:

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-05-03),如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档