为什么微信小程序有的页面不显示tabBar?

由于刚刚接触微信小程序,今天在做tabBar导航时,发现不是所有页面都有tabBar导航,一开始以为自己代码写的有问题,后来,经大佬指点才知道不是所有页面都有tabBar导航,之后tabBar配置文件里的页面才有tabBar导航。

app.json 中tabBar的配置:

"tabBar": {
    "color": "#a9b7b7",
    "selectedColor": "#3281ff",
    "borderStyle": "white",
    "list": [
      {
        "selectedIconPath": "pages/images/home-fill.png",
        "iconPath": "pages/images/home.png",
        "pagePath": "pages/index/index",
        "text": "首页"
      },
      {
        "selectedIconPath": "pages/images/info-fill.png",
        "iconPath": "pages/images/info.png",
        "pagePath": "pages/info/index",
        "text": "动态"
      },
      {
        "selectedIconPath": "pages/images/me-fill.png",
        "iconPath": "pages/images/me.png",
        "pagePath": "pages/home/index",
        "text": "我的"
      }
    ]
  }

如上所示,也就是说,只有pages/index/indexpages/info/indexpages/home/index 这三个页面才会显示tabBar导航。


作者:戴翔
电子邮箱:[email protected]
简介:中华人民共和国公民,中国共青团员,CSDN博客专家,秦淮区疾控中心托管社会公益组织指南针工作室志愿者,创业公司研发中心负责人,在校大学生。


发布了103 篇原创文章 · 获赞 205 · 访问量 62万+

猜你喜欢

转载自blog.csdn.net/yuanxiang01/article/details/88799720