跳至主要內容

单页面配置

刘春龙原创...大约 1 分钟WEB前端小程序教程文档

app.json 中的部分配置,也支持对单个页面进行配置

可以在页面对应的 文件.json 文件来对本页面的表现进行配置

配置项

属性类型默认值描述
navigationBarBackgroundColorHexColor#000000导航栏背景颜色,如 #000000
navigationBarTextStylestringwhite导航栏标题颜色,仅支持 black / white
navigationBarTitleTextstring导航栏标题文字内容
backgroundColorHexColor#ffffff窗口的背景色(开启下拉菜单可以观察)
backgroundTextStylestringdark下拉 loading 的样式,仅支持 dark / light
enablePullDownRefreshbooleanfalse是否开启当前页面下拉刷新
onReachBottomDistancenumber50页面上拉触底事件触发时距页面底部距离,单位为 px。
stylestringdefault启用新版的组件样式
............

注意

虽然配置与 app.json 基本一致,但是注意,不再需要添加 window 作为父级

单页面里的.json配置会覆盖掉app.json的配置

{
  "usingComponents": {},
  "navigationBarBackgroundColor": "#ffffff",
  "navigationBarTextStyle": "black",
  "navigationBarTitleText": "第二个页面",
  "backgroundColor": "#ffffff",
  "backgroundTextStyle": "light",
  "enablePullDownRefresh": true,
  "onReachBottomDistance": 50,
  "style": "v2"
}

自定义 window 和 tabBar

相关信息

  • 自定义 window
"navigationStyle": "custom",

使用官网自带的头部,样式单一,结构固定,不适合复杂业务的处理,因此可以选择当前页面自定义头部布局

  • 自定义 tarBar
"tabBar": {
    "custom":true,
    ……
}

所有 tab 页的 json 里需声明 usingComponents 项,也可以在 app.json 全局开启 custom。

上次编辑于:
贡献者: 刘春龙
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v2.15.7