uni-app 底部导航栏

底部导航栏

  • 当设置 position 为 top 时,将不会显示 icon
  • tabBar 中的 list 是一个数组,只能配置最少2个、最多5个 tab,tab 按数组的顺序排序。
  • tabbar 切换第一次加载时可能渲染不及时,可以在每个tabbar页面的onLoad生命周期里先弹出一个等待雪花(hello uni-app使用了此方式)
  • tabbar 的页面展现过一次后就保留在内存中,再次切换 tabbar 页面,只会触发每个页面的onShow,不会再触发onLoad。
  • 顶部的 tabbar 目前仅微信小程序上支持。需要用到顶部选项卡的话,建议不使用 tabbar 的顶部设置,而是自己做顶部选项卡,可参考 hello uni-app->模板->顶部选项卡。
"tabBar":{
        "color": "#000000",
        "selectedColor":"0faeff",
        "list":[
            {
                "pagePath": "pages/index/index",
                "iconPath":"static/nav1.png",
                "selectedIconPath":"static/nav1-a.png",
                "text":"组件1"
            },{
                "pagePath": "pages/index/index",
                "iconPath":"static/nav2.png",
                "selectedIconPath":"static/nav2-a.png",
                "text":"组件2"
            }
        ]
    }

Api: https://uniapp.dcloud.io/collocation/pages?id=tabbar

原文地址:https://www.cnblogs.com/lxz-blogs/p/12574957.html