<template>
	<view class="searchBg">
		<view class="flex">
			<view class="searchIcon">
				<image src="@/static/images/icon (19).png" mode=""></image>
			</view>
			<view class="inputBox">
				<u-search :placeholder="placeholder" v-model="keyword" :color="'#333'" :placeholder-color="'#B3B3B3'"  :bgColor="'transparent'" :showAction="false" @search="$u.debounce(searchFn, 500)" @clear="searchFn"></u-search>
			</view>
		</view>
	</view>
</template>

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

<style lang="scss" scoped>
	.searchBg {
		background: #f4f4f4;
		width: 100%;
		height: 72rpx;
		border-radius: 36rpx;
		line-height: 72rpx;
		border: 1px solid  rgba(223, 223, 223, 0.4);;
		.flex {
			height: 100%;
			padding: 0 28rpx;
	
			.searchIcon {
				width: 40rpx;
				height: 36rpx;
			}
	
			.inputBox {
				flex: 1;
				// color: #fff;
				font-size: 28rpx;
			}
		}
	}
	
</style>

