编程那点事编程那点事

专注编程入门及提高
探究程序员职业规划之道!

百度小程序tabBar不显示

tabBar,即底部标签栏。

百度小程序tabBar

按照官方文档,在app.json中增加了如下代码

"tabBar": {
        "color": "#a2a2a2",
        "selectedColor": "#3388ff",
        "borderStyle": "black",
        "backgroundColor": "#ffffff",
        "list": [{
            "pagePath": "pages/detail/detail",
            "iconPath": "images/component_normal.png",
            "selectedIconPath": "images/component_selected.png",
            "text": "首页"
        },{
            "pagePath": "pages/index/index",
            "iconPath": "images/API_normal.png",
            "selectedIconPath": "images/API_selected.png",
            "text": "列表"
        }]
    }

但是,编译百度小程序后确看不到底部标签栏,后来找了愿意,是因为list中的pagePath在,app.json中未定义,

app.json pages值

所以把pagePath里的值改成pages里有的,在编译百度小程序就能显示tabBar了。

未经允许不得转载: 技术文章 » 小程序 » 百度小程序tabBar不显示