微信小程序界面开发-底部导航栏

一、例子(代码)
在app.json文件中

"tabBar": {
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "iconPath": "pages/index/images/首页.png",
        "selectedIconPath": "pages/index/images/首页.png"
      },
      {
        "pagePath": "pages/user",
        "text": "我的",
        "iconPath": "pages/index/images/我的.png",
        "selectedIconPath": "pages/index/images/我的.png"
      },
      {
        "pagePath": "pages/message",
        "text": "信息",
        "iconPath": "pages/index/images/message.png",
        "selectedIconPath": "pages/index/images/message.png"
      }
    ]
  }

分析:
tabBar是导航栏,默认在底部,List是它的一个属性,同时,它自己也有四个属性,如上。

  1. pagePath是页面路径,后面对应你要跳转到的页面(必填)
  2. text是文本信息,后面对应你的提示信息,一般与所跳转的页面对应(必填)
  3. iconPath是图像地址,后面对应的你导航栏所对应的图标地址(选填)
  4. selectedIconPath是点击导航栏后你的图像地址,后面对应相应的地址(选填)
    二、效果
    例子
    想要了解更多请点击进入官网
    (参考资料微信开发者文档)
发布了45 篇原创文章 · 获赞 52 · 访问量 2815

猜你喜欢

转载自blog.csdn.net/weixin_43520670/article/details/103247112