提交 e8a49402 编写于 作者: 雪洛's avatar 雪洛

fix: h5端transparentTitle失效的Bug https://ask.dcloud.net.cn/question/91135

上级 4cfee9a0
...@@ -38,6 +38,9 @@ export function parseTitleNView (routeOptions) { ...@@ -38,6 +38,9 @@ export function parseTitleNView (routeOptions) {
( (
windowOptions.navigationStyle === 'custom' && windowOptions.navigationStyle === 'custom' &&
!isPlainObject(titleNView) !isPlainObject(titleNView)
) || (
windowOptions.transparentTitle === 'always' &&
!isPlainObject(titleNView)
) )
) { ) {
return false return false
...@@ -56,7 +59,7 @@ export function parseTitleNView (routeOptions) { ...@@ -56,7 +59,7 @@ export function parseTitleNView (routeOptions) {
titleText: titleImage === '' ? windowOptions.navigationBarTitleText || '' : '', titleText: titleImage === '' ? windowOptions.navigationBarTitleText || '' : '',
titleColor: windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff', titleColor: windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff',
type: titleNViewTypeList[transparentTitle], type: titleNViewTypeList[transparentTitle],
backgroundColor: transparentTitle !== 'always' ? windowOptions.navigationBarBackgroundColor || '#000000' : 'rgba(0,0,0,0)', backgroundColor: windowOptions.navigationBarBackgroundColor || '#f8f8f8',
tags: titleImage === '' ? [] : [{ tags: titleImage === '' ? [] : [{
'tag': 'img', 'tag': 'img',
'src': titleImage, 'src': titleImage,
......
...@@ -39,6 +39,10 @@ import { ...@@ -39,6 +39,10 @@ import {
NAVBAR_HEIGHT NAVBAR_HEIGHT
} from 'uni-helpers/constants' } from 'uni-helpers/constants'
import {
isPlainObject
} from 'uni-shared'
import { import {
mergeTitleNView mergeTitleNView
} from 'uni-helpers/patch' } from 'uni-helpers/patch'
...@@ -164,13 +168,27 @@ export default { ...@@ -164,13 +168,27 @@ export default {
} }
// 将 navigationStyle 和 transparentTitle 都合并到 titleNView // 将 navigationStyle 和 transparentTitle 都合并到 titleNView
let titleNView = this.titleNView let titleNView = this.titleNView
titleNView = Object.assign({}, { if ( // 无头
type: this.navigationStyle === 'custom' ? 'none' : 'default' titleNView === false ||
}, this.transparentTitle in titleNViewTypeList ? { titleNView === 'false' ||
type: titleNViewTypeList[this.transparentTitle] (
} : null, typeof titleNView === 'object' ? titleNView : (typeof titleNView === 'boolean' ? { this.navigationStyle === 'custom' &&
type: titleNView ? 'default' : 'none' !isPlainObject(titleNView)
} : null)) ) || (
this.transparentTitle === 'always' &&
!isPlainObject(titleNView)
)
) {
titleNView = { type: 'none' }
} else {
titleNView = Object.assign({}, {
type: this.navigationStyle === 'custom' ? 'none' : 'default'
}, this.transparentTitle in titleNViewTypeList ? {
type: titleNViewTypeList[this.transparentTitle]
} : null, typeof titleNView === 'object' ? titleNView : (typeof titleNView === 'boolean' ? {
type: titleNView ? 'default' : 'none'
} : null))
}
const yesNoParseList = { const yesNoParseList = {
'YES': true, 'YES': true,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册