diff --git a/src/platforms/app-plus/service/framework/theme.js b/src/platforms/app-plus/service/framework/theme.js index b15225c1f973a00b6fe82fefe57aab1e83f87d17..3fdca941e42b1c5841fa73f354c940bb5789a4a7 100644 --- a/src/platforms/app-plus/service/framework/theme.js +++ b/src/platforms/app-plus/service/framework/theme.js @@ -82,21 +82,21 @@ export function useTabBarThemeChange (tabBar, options) { export function useWebviewThemeChange (webview, getWebviewStyle) { if (__uniConfig.darkmode) { const fn = () => { - const { - animationAlphaBGColor, background, - backgroundColorBottom, backgroundColorTop, - titleNView: { backgroundColor, titleColor } = {} - } = getWebviewStyle() - webview && webview.setStyle({ - animationAlphaBGColor, - background, - backgroundColorBottom, - backgroundColorTop, - titleNView: { - backgroundColor, - titleColor - } - }) + const webviewStyle = getWebviewStyle() + const style = { + animationAlphaBGColor: webviewStyle.animationAlphaBGColor, + background: webviewStyle.background, + backgroundColorBottom: webviewStyle.backgroundColorBottom, + backgroundColorTop: webviewStyle.backgroundColorTop + } + var titleNView = webviewStyle.titleNView + if (typeof titleNView !== 'undefined') { + style.titleNView = typeof titleNView === 'object' ? { + backgroundColor: titleNView.backgroundColor, + titleColor: titleNView.titleColor + } : titleNView + } + webview && webview.setStyle(webviewStyle) } onThemeChange(fn) webview.addEventListener('close', () => offThemeChange(fn))