<template>
	<!-- header -->
	<view :style="{ backgroundColor:backgroundColor }" class="navigationBar">
		<template>
			<!-- #ifdef MP-WEIXIN -->
			<view class="navigationBarBack" @click="back">
				<uni-icons size="24" type="left" :color="titleColor"></uni-icons>
			</view>
			<!-- #endif -->
			<!-- #ifdef H5 -->
			<view class="navigationBarBack">
			</view>
			<!-- #endif -->
			<view class="navigationBarTitle" :style="{ color: titleColor }">
				{{ title }}
			</view>
			<view class="navigationBarIcon" :style="{ color: titleColor }">
			</view>
		</template>
	</view>
</template>

<script>
	/* 计算标题位置 */
	import {
		getWXStatusHeight
	} from "@/utils/common.js";

	export default {
		props: {
			backgroundColor: {
				type: String,
				default: '#317DFA'
			},
			title: String,
			titleColor: {
				type: String,
				default: '#fff'
			},
			navigatePath: {
				type: String,
				default: '000'
			},
		},
		data() {
			return {

			}
		},
		methods: {
			back() {
				console.log('返回');
				if (this.navigatePath && this.navigatePath != '000') {
					this.$tab.navigateTo(this.navigatePath)
				} else {
					uni.navigateBack()
				}

			},
			clearNoReadFun() {
				this.$emit('clearNoRead')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.navigationBar {
		position: absolute;
		top: var(--status-bar-height);
		height: 110rpx;
		width: 100%;
		display: flex;
		align-items: center;
		font-size: 30rpx;
		justify-content: center;
		z-index: 9;
		box-sizing: border-box;
		padding-top: 20rpx;

		.navigationBarBack {
			padding-left: 20rpx;
			width: 200rpx;
		}

		.navigationBarTitle {
			flex: 1;
			text-align: center;
		}

		.navigationBarIcon {
			width: 200rpx;
		}
	}
</style>