方法1:在pages.json
{
...
"pages": [
{
"path": "XXXX",
"style": {
"navigationBarTitleText": "导航栏",
"navigationStyle": "custom" // 使用自定义导航栏,系统会关闭默认的原生导航栏
}
},
...
]
...
}
原生小程序也可以采用类似的方法去掉顶部,让头部变透明
方法2:在pages.json
{
...
"pages": [
{
"path": "XXXX",
"style": {
"navigationBarTitleText": "导航栏",
"app-plus": {
"titleNView": false //禁用原生导航栏
}
}
},
...
]
...
}
方法3:用css隐藏
/* #ifdef H5 */
uni-page-head {
display: none;
}
/* #endif */
如果要禁用所有页面的导航栏
在pages.json
{
...
"globalStyle": {
"app-plus": {
"titleNView": false //禁用原生导航栏
},
...
},
...
}