提交 2443ba1e 编写于 作者: W wangyaqi

update: H5支持titleNview->type='float'

上级 6928528c
...@@ -27,7 +27,7 @@ const passiveOptions = supportsPassive ? { ...@@ -27,7 +27,7 @@ const passiveOptions = supportsPassive ? {
function updateCssVar (vm) { function updateCssVar (vm) {
if (uni.canIUse('css.var')) { if (uni.canIUse('css.var')) {
const pageVm = vm.$parent.$parent const pageVm = vm.$parent.$parent
const windowTop = pageVm.showNavigationBar && pageVm.navigationBar.type !== 'transparent' && pageVm.navigationBar.type !== 'alwaysTransparent' ? (NAVBAR_HEIGHT + const windowTop = pageVm.showNavigationBar && pageVm.navigationBar.type !== 'transparent' && pageVm.navigationBar.type !== 'float' ? (NAVBAR_HEIGHT +
'px') 'px')
: '0px' : '0px'
const windowBottom = getApp().$children[0].showTabBar ? (TABBAR_HEIGHT + 'px') : '0px' const windowBottom = getApp().$children[0].showTabBar ? (TABBAR_HEIGHT + 'px') : '0px'
......
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
const titleNViewTypeList = { const titleNViewTypeList = {
'none': 'default', 'none': 'default',
'auto': 'transparent', 'auto': 'transparent',
'always': 'alwaysTransparent' 'always': 'float'
} }
const navigationBar = mergeTitleNView({ const navigationBar = mergeTitleNView({
...@@ -158,7 +158,8 @@ export default { ...@@ -158,7 +158,8 @@ export default {
titleImage: this.titleImage, titleImage: this.titleImage,
duration: '0', duration: '0',
timingFunc: '', timingFunc: '',
type: titleNViewTypeList[this.transparentTitle] type: titleNViewTypeList[this.transparentTitle],
transparentTitle: this.transparentTitle
}, this.titleNView) }, this.titleNView)
const showNavigationBar = this.navigationStyle === 'default' && this.titleNView const showNavigationBar = this.navigationStyle === 'default' && this.titleNView
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
</div> </div>
</div> </div>
<div <div
v-if="type!=='transparent'&&type!=='alwaysTransparent'" v-if="type!=='transparent'&&type!=='float'"
class="uni-placeholder"/> class="uni-placeholder"/>
</uni-page-head> </uni-page-head>
</template> </template>
...@@ -335,7 +335,7 @@ export default { ...@@ -335,7 +335,7 @@ export default {
type: { type: {
default: 'default', default: 'default',
validator (value) { validator (value) {
return ['default', 'transparent', 'alwaysTransparent'].indexOf(value) !== -1 return ['default', 'transparent', 'float'].indexOf(value) !== -1
} }
}, },
coverage: { coverage: {
...@@ -357,6 +357,12 @@ export default { ...@@ -357,6 +357,12 @@ export default {
titleImage: { titleImage: {
type: String, type: String,
default: '' default: ''
},
transparentTitle: {
default: 'none',
validator (value) {
return ['none', 'auto', 'always'].indexOf(value) !== -1
}
} }
}, },
data () { data () {
......
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
borderRadiusElemStyle.backgroundColor = `rgba(${rgba})` borderRadiusElemStyle.backgroundColor = `rgba(${rgba})`
}) })
}) })
} else if (this.type === 'alwaysTransparent') { } else if (this.transparentTitle === 'always') {
const iconElems = this.$el.querySelectorAll('.uni-btn-icon') const iconElems = this.$el.querySelectorAll('.uni-btn-icon')
const iconElemsStyles = [] const iconElemsStyles = []
for (let i = 0; i < iconElems.length; i++) { for (let i = 0; i < iconElems.length; i++) {
...@@ -71,13 +71,13 @@ export default { ...@@ -71,13 +71,13 @@ export default {
}, },
computed: { computed: {
color () { color () {
return this.type === 'transparent' || this.type === 'alwaysTransparent' ? '#fff' : this.textColor return this.type === 'transparent' || this.transparentTitle === 'always' ? '#fff' : this.textColor
}, },
offset () { offset () {
return parseInt(this.coverage) return parseInt(this.coverage)
}, },
bgColor () { bgColor () {
if (this.type === 'transparent' || this.type === 'alwaysTransparent') { if (this.type === 'transparent' || this.transparentTitle === 'always') {
const { const {
r, r,
g, g,
......
...@@ -17,7 +17,7 @@ export default function getWindowOffset () { ...@@ -17,7 +17,7 @@ export default function getWindowOffset () {
const pages = getCurrentPages() const pages = getCurrentPages()
if (pages.length) { if (pages.length) {
const pageVm = pages[pages.length - 1].$parent.$parent const pageVm = pages[pages.length - 1].$parent.$parent
top = pageVm.showNavigationBar && (pageVm.navigationBar.type !== 'transparent' || pageVm.navigationBar.type !== 'alwaysTransparent') ? NAVBAR_HEIGHT : 0 top = pageVm.showNavigationBar && (pageVm.navigationBar.type !== 'transparent' || pageVm.navigationBar.type !== 'float') ? NAVBAR_HEIGHT : 0
} }
const app = getApp() const app = getApp()
if (app) { if (app) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册