小程序开发之页面配置.json

版权声明:欢迎转载,可Chat交流,写博不易请标明出处: https://blog.csdn.net/JackJia2015/article/details/85694952

上一篇文章咱们介绍了App.json全局配置,如果我们不想全局使用,只想在单独页面配置怎么办???
小程序为我们提供了页面.json的页面配置文件

每一个小程序页面也可以使用.json文件来对本页面的窗口表现进行配置。
注:
(1)页面的配置只能设置 app.json 中部分 window 配置项的内容
(2)页面中配置项会覆盖 app.json 的 window 中相同的配置项。
(3)如果页面没有配置键值对,则需要{}来填补空白在这里插入图片描述
例如

{
    "navigationBarBackgroundColor": "#000000",   //导航栏背景颜色
    "navigationBarTextStyle":"white",            //导航栏标题颜色,仅支持 black / white
    "navigationBarTitleText": "导航条标题",        //导航栏标题文字内容
    "navigationStyle":"default",                 //导航栏样式,default 默认样式 custom 自定义导航栏
    "backgroundColor":"grey",                    //窗口的背景色,如设置下拉顶部窗口颜色将覆盖背景色
    "enablePullDownRefresh":true,		         //是否开启当前页面的下拉刷新
    "backgroundTextStyle":"dark",                //下拉 loading 的样式,仅支持 dark / light
    "onReachBottomDistance":50,                  //页面上拉触底事件触发时距页面底部距离,单位为px。
    "disableScroll":"true",                      //设置为 true 则页面整体不能上下滚动。
    "disableSwipeBack":"true"                    //禁止页面右滑手势返回
  },

上一篇文章咱们介绍了App.json全局配置,如果我们不想全局使用,只想在单独页面配置怎么办???
小程序为我们提供了页面.json的页面配置文件

每一个小程序页面也可以使用.json文件来对本页面的窗口表现进行配置。
注:
(1)页面的配置只能设置 app.json 中部分 window 配置项的内容
(2)页面中配置项会覆盖 app.json 的 window 中相同的配置项。
(3)如果页面没有配置键值对,则需要{}来填补空白

例如
{
“navigationBarBackgroundColor”: “#000000”, //导航栏背景颜色
“navigationBarTextStyle”:“white”, //导航栏标题颜色,仅支持 black / white
“navigationBarTitleText”: “导航条标题”, //导航栏标题文字内容
“navigationStyle”:“default”, //导航栏样式,default 默认样式 custom 自定义导航栏
“backgroundColor”:“grey”, //窗口的背景色,如设置下拉顶部窗口颜色将覆盖背景色
“enablePullDownRefresh”:true, //是否开启当前页面的下拉刷新
“backgroundTextStyle”:“dark”, //下拉 loading 的样式,仅支持 dark / light
“onReachBottomDistance”:50, //页面上拉触底事件触发时距页面底部距离,单位为px。
“disableScroll”:“true”, //设置为 true 则页面整体不能上下滚动。
“disableSwipeBack”:“true” //禁止页面右滑手势返回
},

注:
disableScroll只在页面配置中有效,无法在 app.json 中设置

猜你喜欢

转载自blog.csdn.net/JackJia2015/article/details/85694952
今日推荐