|
@@ -10,7 +10,7 @@ export default defineComponent({
|
|
|
title: String,
|
|
|
isBack: {
|
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
+ default: true
|
|
|
},
|
|
|
backIconColor: {
|
|
|
// 返回按钮颜色
|
|
@@ -37,7 +37,7 @@ export default defineComponent({
|
|
|
rightText: String,
|
|
|
onClickRight: {
|
|
|
type: Function,
|
|
|
- default: () => {}
|
|
|
+ default: () => ({})
|
|
|
},
|
|
|
border: {
|
|
|
type: Boolean,
|
|
@@ -46,7 +46,7 @@ export default defineComponent({
|
|
|
onHeaderBack: {
|
|
|
// 头部高度设置后返回
|
|
|
type: Function,
|
|
|
- default: () => {}
|
|
|
+ default: () => ({})
|
|
|
},
|
|
|
desotry: {
|
|
|
// 用于组件销毁时,是否重置原生头部样式
|
|
@@ -54,15 +54,15 @@ export default defineComponent({
|
|
|
default: true
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- backIconColor() {
|
|
|
- // 设置返回按钮颜色
|
|
|
- postMessage({
|
|
|
- api: 'backIconChange',
|
|
|
- content: { iconStyle: this.backIconColor }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
+ // watch: {
|
|
|
+ // backIconColor() {
|
|
|
+ // 设置返回按钮颜色
|
|
|
+ // postMessage({
|
|
|
+ // api: 'backIconChange',
|
|
|
+ // content: { iconStyle: this.backIconColor }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // },
|
|
|
data() {
|
|
|
return {
|
|
|
headerTitle: null as any,
|
|
@@ -79,27 +79,19 @@ export default defineComponent({
|
|
|
unmounted() {
|
|
|
if (this.desotry) {
|
|
|
// 设置是否显示导航栏 0 不显示 1 显示
|
|
|
- postMessage({ api: 'setBarStatus', content: { status: 1 } })
|
|
|
+ // postMessage({ api: 'setBarStatus', content: { status: 1 } })
|
|
|
// 设置返回按钮颜色
|
|
|
- postMessage({
|
|
|
- api: 'backIconChange',
|
|
|
- content: { iconStyle: 'black' }
|
|
|
- })
|
|
|
+ // postMessage({
|
|
|
+ // api: 'backIconChange',
|
|
|
+ // content: { iconStyle: 'black' }
|
|
|
+ // })
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- navBarInit(callBack?: Function) {
|
|
|
- // 设置是否显示导航栏 0 不显示 1 显示
|
|
|
- postMessage({ api: 'setBarStatus', content: { status: 0 } })
|
|
|
- // 设置返回按钮颜色
|
|
|
- postMessage({
|
|
|
- api: 'backIconChange',
|
|
|
- content: { iconStyle: this.backIconColor || 'black' }
|
|
|
- })
|
|
|
-
|
|
|
+ navBarInit(callBack?: any) {
|
|
|
const sNavHeight = sessionStorage.getItem('navHeight')
|
|
|
- const sTitleHeight = sessionStorage.getItem('titleHeight')
|
|
|
- if (sNavHeight && sTitleHeight) {
|
|
|
+ // const sTitleHeight = sessionStorage.getItem('titleHeight')
|
|
|
+ if (sNavHeight) {
|
|
|
this.navBarHeight = Number(sNavHeight)
|
|
|
callBack && callBack()
|
|
|
} else {
|
|
@@ -111,19 +103,17 @@ export default defineComponent({
|
|
|
sessionStorage.setItem('navHeight', String(navHeight))
|
|
|
this.navBarHeight = navHeight
|
|
|
}
|
|
|
- if (content.titleHeight) {
|
|
|
- // 导航栏的高度
|
|
|
- const titleHeight = content.titleHeight / dpi
|
|
|
- sessionStorage.setItem('titleHeight', String(titleHeight))
|
|
|
- this.titleHeight = titleHeight
|
|
|
- }
|
|
|
callBack && callBack()
|
|
|
})
|
|
|
}
|
|
|
!browser().isApp && callBack && callBack()
|
|
|
},
|
|
|
onClickLeft() {
|
|
|
- this.$router.back()
|
|
|
+ if (browser().isApp) {
|
|
|
+ postMessage({ api: 'goBack' })
|
|
|
+ } else {
|
|
|
+ this.$router.back()
|
|
|
+ }
|
|
|
},
|
|
|
clickRight() {
|
|
|
this.onClickRight && this.onClickRight()
|
|
@@ -145,7 +135,6 @@ export default defineComponent({
|
|
|
) : (
|
|
|
<>
|
|
|
<div
|
|
|
- // style={{ paddingTop: `${this.navBarHeight}px` }}
|
|
|
style={{
|
|
|
minHeight: `calc(var(--van-nav-bar-height) + ${this.navBarHeight}px)`
|
|
|
}}
|