提交 869d515f 编写于 作者: L liuxiaohang

fix(app-plus): 修复用户调用setNavigationBarColor设置颜色过早时,会被覆盖的bug

上级 b5d37560
......@@ -40,6 +40,15 @@ export function hideNavigationBarLoading () {
}
}
function setPageMeta (statusBarStyle) {
const pages = getCurrentPages()
if (!pages.length) {
return
}
// 框架内部页面跳转会从这里获取style配置
pages[pages.length - 1].$page.meta.statusBarStyle = statusBarStyle
}
export function setNavigationBarColor ({
frontColor,
backgroundColor
......@@ -53,12 +62,17 @@ export function setNavigationBarColor ({
if (backgroundColor) {
styles.backgroundColor = backgroundColor
}
plus.navigator.setStatusBarStyle(frontColor === '#000000' ? 'dark' : 'light')
const statusBarStyle = frontColor === '#000000' ? 'dark' : 'light'
plus.navigator.setStatusBarStyle(statusBarStyle)
// 用户调用api时同时改变当前页配置,这样在系统调用设置时,可以避免覆盖用户设置
setPageMeta(statusBarStyle)
const style = webview.getStyle()
if (style && style.titleNView) {
if (style.titleNView.autoBackButton) {
styles.backButton = styles.backButton || {}
styles.backButton.color = frontColor
if (style && style.titleNView) {
if (style.titleNView.autoBackButton) {
styles.backButton = styles.backButton || {}
styles.backButton.color = frontColor
}
webview.setStyle({
titleNView: styles
......@@ -71,4 +85,4 @@ export function setNavigationBarColor ({
return {
errMsg: 'setNavigationBarColor:fail'
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册