<template name="headerNavbar">
	<!-- 自定义导航栏 -->
	<view class='navbar-wrap' :style="{height:(CustomBar+50)+'px',paddingTop:StatusBar+'px'}"> 
	  	<view class="navbar-text" 
			  :style="{color:navbarData.textColor ? navbarData.textColor:'',lineHeight:(CustomBar - StatusBar)+'px;',fontSize:fontSizeSetting+'px;',paddingLeft:navbarData.textLeft ? '' : 12+'px'}" :class="platformClass">
	    	  {{navbarData.title ? navbarData.title : " "}}
	  	</view>
		<view class="search-input">
			<view class="gosearch-btn" @click="this.$api.navigateTo(clickPath)">
				<text class="iconfont icon-iconfonticonfontsousuo1"></text>
				<text>{{hotSearchText}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	var self;
	import btSearch from '@/components/uni-search/bt-search.vue'
	export default{
		name:'headerNavbar',
		components:{
			btSearch,
		},
		props:{
		    navbarData: { // 由父页面传递的数据
				type: Object
		    }
		},
		data() {
			return{
				clickPath:'/pages/search/search',
				hotSearchText:'你想要的这里都有',
				CustomBar:this.CustomBar,// 顶部导航栏高度
				StatusBar: this.StatusBar,
				fontSizeSetting:this.fontSizeSetting,
				screenWidth:this.screenWidth,
				capsule:this.capsule,
				platformClass:this.platformClass,
			}
		},
		created() {
			if (getCurrentPages().length === 1) { // 当只有一个页面时
			      this.navbarData.haveBack = false;
			} else {
			      this.navbarData.haveBack = true;
			}
		},
		onLoad(){
			
		},
		methods:{
			BackPage: function () {
				this.$emit('navigateBack')
		    },
			_goSearchPath:function () {
				this.$emit('goSearchPath')
			},
			_goHome:function(){
				uni.switchTab({
		        	url: '/pages/tabBar/home/home'
		      	})
			}
		},
		onShow(){
	
		}
	}
</script>

<style lang="scss">
	.navbar-wrap {
		 position: fixed;
		 width: 100%;
		 top: 0;
		 z-index: 100000;
		 box-sizing: border-box;
		 background: url(https://admin-b.caimei365.com/userfiles/1/images/photo/2020/05/%E8%83%8C%E6%99%AF1%402x.png);
		 background-size: cover;
		 border-bottom:none;
	}
	.navbar-text {
		 font-size: 30rpx;
		 color: #000000;
		 font-weight: 500;
	}
	.navbar-text.center{
		text-align: center;
	}
	.navbar-text.left{
		text-align: left;
		padding-left: 45px;
	}
	.navbar-icon {
		 position: fixed;
		 display: flex;
		 box-sizing: border-box;
	}
	.navbar-icon .iconfont {
		 display: inline-block;
		 overflow: hidden;
		 font-size: 44rpx;
		 padding-right:40rpx;
		 margin-top: 1px;
	}
	.navbar-icon .icon-iconfonticonfontsousuo1 {
		color: #000000;
	}
	.navbar-icon view {
		 height: 18px;
		 border-left: 0.5px solid rgba(0,0,0, 0.3);
		 margin-top: 6px;
	}
	.navbar-loading {
		 background: #fff;
		 text-align: center;
	}
	.search-input{
		width: 100%;
		height: 70rpx;
		padding: 20rpx 0 10rpx 0;
		.gosearch-btn{
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			flex: 1;
			flex-direction: row;
			justify-content: center;
			align-items: center;
			width: 662rpx;
			height: 100%;
			border-radius: 40rpx;
			background: #F0F0F0;
			margin: 0 auto;
			padding:0 20rpx;
			font-size: 28rpx;
			line-height: 70rpx;
			color: #8A8A8A;
			background: #FFFFFF;
			.icon-iconfonticonfontsousuo1{
				margin:0 6rpx;
				font-size: 34rpx;
				color: #8A8A8A;
				z-index: 10;
			}
		}
	}
</style>