Skip to content

UNIAPP 全局配置

  • pages.json 里面修改
js

"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "uni-app",
		"navigationBarBackgroundColor": "#F8F8F8",
		"backgroundColor": "#F8F8F8"
	},

配置文件如下

用于设置应用的状态栏,导航条,标题,窗口背景色等等详细文档

属性类型默认值描述
navigationBarBackgroundColorHexColor#F7F7F7导航栏背景颜色(同状态栏背景色)
navigationBarTextStyleStringwhite导航栏标题颜色及状态栏前景颜色,仅支持 black/white
navigationBarTitleTextString导航栏标题文字内容
backgroundColorHexColor#ffffff窗口的背景色
backgroundTextStyleStringdark下拉 loading 的样式,仅支持 dark / light
enablePullDownRefreshBooleanfalse是否开启下拉刷新,详见页面生命周期。
onReachBottomDistanceNumber50页面上拉触底事件触发时距页面底部距离,单位只支持 px,

改变每个页面的 title

  • 如果想改变每个页面的 title,那就在 pages 下面的 style 里面写

  • 想看哪个页面就把哪个页面放在首位

js
{
  "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "首页"
            }
        }
    ],
}