频道栏目
首页 > 资讯 > 微信公众平台开发 > 正文

微信小程序之tabBar配置教程

17-12-04        来源:[db:作者]  
收藏   我要投稿

微信小程序之tabBar配置教程 ,如果小程序是一个多 tab 应用(客户端窗口的底部或顶部有 tab 栏可以切换页面),可以通过 tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。

Tip:

当设置 position 为 top 时,将不会显示 icon tabBar 中的 list 是一个数组,只能配置最少2个、最多5个 tab,tab 按数组的顺序排序。

属性说明:
这里写图片描述

其中 list 接受一个数组,数组中的每个项都是一个对象,其属性值如下:
这里写图片描述

我项目做了一个简单配置 (app.json文件里), 大家可以参考下:

 "tabBar": {
    "borderStyle": "white",
    "position": "bottom",
    "selectedColor": "blue",
    "list": [
      {
        "pagePath": "pages/home/home",
        "text": "阅读",
        "iconPath": "images/icon/yuedu.png",
        "selectedIconPath": "images/icon/yuedu_hl.png"
      },
      {
        "pagePath": "pages/music/music",
        "text": "音乐",
        "iconPath": "images/icon/dianying.png",
        "selectedIconPath": "images/icon/dianying_hl.png"
      },
      {
        "pagePath": "pages/video/video",
        "text": "电影",
        "iconPath": "images/icon/dianying.png",
        "selectedIconPath": "images/icon/dianying_hl.png"
      }
    ]
  }

如图:

这里写图片描述

ps : 配置 tabBar 的 icon 图标一定是相对路径 ,拒绝写绝对路径 !

相关TAG标签
上一篇:node模块间传值:global、module.exports、exports讲解
下一篇:手把手教你搭建vue环境
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站