<template>
	<view :class="themeType?'whiteHeaderBox':''">
		<view :style="{ height: mobileTopHeight + 'px' }" class="statusBar">
			
		</view>
		<view class="headerBox">
			<uni-icons @click="goBackFn" v-show="showBack" class="backImg" type="arrowleft" size="24"></uni-icons>
			<slot></slot>
		</view>
	</view>
</template>

<script>
	import uniIcons from "@/components/uni-icons/uni-icons.vue"
	export default {
		props:['showBack','themeType'],
		components:{uniIcons}, 
		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>
