您好,小程序模板欢迎您。
小程序模板
当前位置 : 首页> 小程序教程> 微信小程序怎么实现tabBar功能?

微信小程序怎么实现tabBar功能?

app.json

{
  "tabBar": {
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "iconPath": "icons/home.png",
        "selectedIconPath": "icons/home_selected.png"
      },
      {
        "pagePath": "pages/mine/mine",
        "text": "我的",
        "iconPath": "icons/mine.png",
        "selectedIconPath": "icons/mine_selected.png"
      }
    ],
    "selectedColor": "#1296db"
  }
}


然后,在每个页面的 .json 文件中设置 navigationBarTitleText 属性,用于显示页面标题。

{
  "navigationBarTitleText": "首页"
}


最后,在每个页面的 .wxml 文件中使用 navigator 组件来实现页面跳转。


这样就可以实现微信小程序的 tabar 切换功能了。

联系客服 意见反馈

签到成功!

已连续签到1天,签到3天将获得积分VIP1天

知道了