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

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

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