<template>
<view>
	<u-search placeholder="搜索人脉、联络记录、人脉指南" :show-action="!global" v-model="key"
		:disabled="global" @click="cLick" @custom="search" @search="search"/>
</view>
</template>

<script>
export default {
	props: {
		global: {//是否全局搜索
			type: Boolean,
			default: false,
		},
		searchKey: {//搜索条件
			type: String,
			default: '',
		},
	},
	data() {
		return {
			key: this.searchKey
		}
	},
	methods: {
		cLick() {
			if (this.global) {
				uni.navigateTo({
					url: '/pages/home/search',
				})
			}
		},
		search() {
			if (!this.global) {
				this.$emit('update:searchKey', this.key)
				this.$emit('search', this.key)
			}
		},
	},
}
</script>

<style>
</style>
