jiaju/component/pageHead.vue

121 lines
2.9 KiB
Vue

<template>
<view :style="{'height':customBar}" class="head" :class="brF?'br':''">
<view :style="{'height':customBar}" class="headCom" :class="brF?'br':''">
<image @click="navigateBackFun()" class="imh" v-if="navState" src="../static/fh.png" mode=""></image>
<view class="textInt">
{{text}}
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
customBar:"170rpx"
}
},
props:{
text:String,
brF:Boolean,
navState:Boolean,
},
mounted(){
uni.getSystemInfo({
success: (e) => {
let statusBar = 0
let customBar = 0
// #ifdef MP
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + 45
if (e.platform === 'android') {
this.$store.commit('SET_SYSTEM_IOSANDROID', false)
customBar = e.statusBarHeight + 50
}
// #endif
// #ifdef MP-WEIXIN
statusBar = e.statusBarHeight
// @ts-ignore
const custom = wx.getMenuButtonBoundingClientRect()
customBar = custom.bottom + custom.top - e.statusBarHeight
// #endif
// #ifdef MP-ALIPAY
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + e.titleBarHeight
// #endif
// #ifdef APP-PLUS
console.log('app-plus', e)
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + 45
// #endif
// #ifdef H5
statusBar = 0
customBar = e.statusBarHeight + 45
// #endif
this.customBar=customBar+100+"rpx"
console.log( this.customBar)
}
})
},
methods: {
navigateBackFun(){
uni.navigateBack()
},
}
}
</script>
<style>
.head{
width: 100%;
background-color: #F5F5F5
}
.headCom{
position: fixed;
width: 100%;
z-index: 9999;
display: flex;
align-items: flex-end;
justify-content: center;
left: 0px;
background-color: #F5F5F5;
padding-bottom: 30rpx;
box-sizing: border-box;
top: 0rpx;
}
.imh{
width: 30rpx;
height: 30rpx;
position: absolute;
left: 40rpx;
}
.br{
background-color: #FFFFFF;
}
.textInt{
font-size: 32rpx;
font-weight: bold;
color: #000000;
}
</style>