状态栏
Framework7 带有状态栏组件(cordova-plugin-statusbar 的包装器)cordova-plugin-statusbar此功能仅在应用在 cordova/capacitor 环境下运行且安装了
This functionality is only available when app is running under cordova/capacitor environment with installed cordova-plugin-statusbar
状态栏应用参数
可以通过在应用初始化时传递状态栏相关参数来控制一些默认状态栏行为。statusbar
派发动作
var app = new Framework7({
statusbar: {
iosOverlaysWebView: true,
},
});
现在让我们来看看所有可用参数的列表。
参数 | 类型 | 默认 | 描述 |
---|---|---|---|
启用 | 布尔值 | true | 启用 Framework7 的状态栏处理。如果你不想 Framework7 处理状态栏行为,请禁用它。 |
iosBackgroundColor | 字符串 | 十六进制字符串(#RRGGBB )在应用在 iOS 设备上运行时的背景颜色。如果传递,则将覆盖 CSS 值 | |
androidBackgroundColor | 字符串 | 十六进制字符串(#RRGGBB )在应用在 Android 设备上运行时的背景颜色。如果传递,则将覆盖 CSS 值 | |
scrollTopOnClick | 布尔值 | true | 如果启用,则点击状态栏覆盖层将使页面内容滚动到顶部。 |
iosOverlaysWebView | 布尔值 | true | 当应用在 iOS 设备上运行时,使状态栏覆盖层或不在 WebView 上覆盖。 |
androidOverlaysWebView | 布尔值 | true | 当应用在 Android 设备上运行时,使状态栏覆盖层或不在 WebView 上覆盖。 |
iosTextColor | 字符串 | black | 应用在 iOS 设备上运行时状态栏的文本颜色。可以是 |
androidTextColor | 字符串 | black | 应用在 Android 设备上运行时状态栏的文本颜色。可以是 |
状态栏应用方法
应用初始化后,我们可以通过使用与状态栏相关的应用方法来控制状态栏:
app.statusbar.hide() | 隐藏状态栏 |
app.statusbar.show() | 显示状态栏 |
app.statusbar.overlaysWebView(overlays) | 使状态栏覆盖或不在 WebView 上覆盖
|
app.statusbar.setTextColor(color) | 设置/更改状态栏文本颜色。
|
app.statusbar.setBackgroundColor(hex) | 设置/更改状态栏背景颜色
|
app.statusbar.isVisible() | 返回true 系统状态栏是否可见,以及false 当它不可见时 |