2024-04-15 17:23:33 +08:00

65 lines
1.4 KiB
Vue

<template>
<view :class="themeType?'whiteHeaderBox':''">
<view :style="{ height: mobileTopHeight + 'px' }" class="statusBar">
</view>
<view class="headerBox">
<uni-icons2 @click="goBackFn" v-show="showBack" class="backImg" type="arrowleft" size="24"></uni-icons2>
<slot></slot>
</view>
</view>
</template>
<script>
export default {
props:['showBack','themeType'],
data() {
return {
mobileTopHeight: 0
};
},
mounted() {
// if(uni.getMenuButtonBoundingClientRect()){
// this.mobileTopHeight = uni.getMenuButtonBoundingClientRect().top
// }else{
// this.mobileTopHeight = 0
// }
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight
uni.setStorageSync('systemInfo',res)
console.log(res)
}
})
console.log('this.mobileTopHeight',this.mobileTopHeight)
},
methods:{
goBackFn(){
uni.navigateBack({
success: function() {
// console.log('getCurrentPages()',getCurrentPages())
// let page = getCurrentPages()[0]; //跳转页面成功之后
// if(page.route=='pages/projectManage/projectManage'){
// }
// if (!page) return;
// page.onLoad(); //如果页面存在,则重新刷新页面
}
})
}
}
}
</script>
<style lang="scss" scoped>
.statusBar{
background-color: #2a2b5b;
}
.whiteHeaderBox{
.statusBar{
background-color: #2b8df3;
}
}
</style>