利用HBuilderx工具创建uniapp、vue3项目,生成pages.json如下:
{
"pages": [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
}
如上代码所示, "pages/index/index"页面带有顶部导航栏,标题为 "uni-app"。在实际项目,如果不需要这个导航栏,该如何设置呢,其实很简单,只需要将"navigationBarTitleText"为空, 并添加"navigationStyle": "custom"样式。
"navigationBarTitleText": "", //取消显示顶部导航栏
"navigationStyle": "custom"