<template>
	<view class="searchBg">
		<view class="flex">
			<view class="searchIcon">
				<image src="@/static/images/car/ic_sousuo.png" mode=""></image>
			</view>
			<view class="inputBox">
				<u-search :placeholder="placeholder" border="none" clearable v-model="keywords" :color="'#1989FA'"  :bgColor="'transparent'" :showAction="false" 
					:placeholderColor="'#1989FA'" @search="$u.debounce(searchFn, 500)" @clear="searchFn"></u-search>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['placeholder'],
		data() {
			return {
				keywords: ''
			}
		},
		methods: {
			searchFn() {
				this.$emit('searchFn', this.keywords)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.searchBg {
		background: rgba(255,255,255,0.46);
		border: 2px solid rgba(255,255,255,0.3);
		width: 100%;
		height: 72rpx;
		border-radius: 16rpx;
		line-height: 72rpx;
		margin-bottom: 28rpx;
		.flex {
			height: 100%;
			padding: 0 28rpx;
	
			.searchIcon {
				width: 40rpx;
				height: 40rpx;
			}
	
			.inputBox {
				padding-left: 28rpx;
				flex: 1;
				color: #fff;
				font-size: 28rpx;
			}
		}
	}
	.placeholderClass {
		color: #1989FA !important;
	}
</style>